Hi,

I am wondering why you would like to add these methods add all to the
model.
If you moved model authorization to a db based system you do not need
these anymore.
I would suggest to adapt the authorization system of activescaffold to
call your specific functions.

--
Volker

On 27 Apr., 05:56, stam <[email protected]> wrote:
> Thanks for your response.
>
> I had thought of the production mode scenario as well. I was thinking
> of "pre-loading" into the model(s) all the permissions created on
> rails startup. Although I was looking to tackle that bit once I had
> the above figured out.
>
> I was actually looking to do something like this as adding all the
> CRUD methods for a model attribute to a model beforehand would be
> tedious. Plus I believe it would degrade performance if for each of
> the scaffolds it had to go through all those methods per attribute. If
> I have 10 attributes on my model, that would be 40 methods!
>
> If adding dynamically is something that I cannot do though, how would
> you suggest I tackle a situation like this?
>
> Appreciate any insight you can provide.
>
> On Apr 26, 4:17 am, "Sergio Cambra .:: entreCables S.L. ::."
>
>
>
> <[email protected]> wrote:
> > On Lunes, 26 de Abril de 2010 07:45:41 stam escribió:
>
> > > Hi all,
>
> > > First of all, great job on building a great plugin.
>
> > > I had a question regarding the addition of the CRUD security methods
> > > to the models. I have written a user-roles-premissions framework in
> > > which an admin can define model level permissions on the fly. When
> > > such permissions are defined, I would like to add activescaffold
> > > security methods to the respective model on the fly. Following is how
> > > I'm trying to set it up at the moment on the model in which I need to
> > > specify security for the action...
>
> > > def self.add_column_security(method_name, module_name, action,
> > > field_name)
> > >     if !method_defined?(method_name)
> > >       logger.info("----> Creating security method - #{method_name}
> > > (#{module_name}, #{action}, #{field_name})")
> > >       define_method(method_name) do
> > >         logger.info("---->>> #{method_name} CALLED!!")
> > >         current_user.action_allowed_for?(action, module_name,
> > > field_name)
> > >       end
> > >     end
> > > end
>
> > > I do not see the method being called though when I access the scaffold
> > > of the model. Could you guys point out what I'm doing wrong here, or
> > > if something like this is possible at all?
>
> > > Thanks
>
> > In development mode that won't work, classes are reloaded in each request.
> >  In production mode I think that will fail when application is restarted.
>
> > --
> > Sergio Cambra .:: entreCables S.L. ::.
> > Mariana Pineda 23, 50.018 Zaragoza
> > T) 902 021 404 F) 976 52 98 07 E) [email protected]
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "ActiveScaffold : Ruby on Rails plugin" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to 
> > [email protected].
> > For more options, visit this group 
> > athttp://groups.google.com/group/activescaffold?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "ActiveScaffold : Ruby on Rails plugin" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/activescaffold?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en.

Reply via email to