Thanks for the tip. I worked around my issue using other methods, but this
is quite useful. Thank you very much.


On Mon, Apr 21, 2014 at 11:00 AM, Sergio Cambra <[email protected]>wrote:

> Not possible, you should add an attr_accessor in your model and override
> do_new method to set the accessor with session value
>
> MODEL
>
> attr_accessor :exam_id
>
> def my_field_authorized_for_create?
>     if @exam_id == x
>         return true
>     else
>         return false
>      end
> end
>
>
> CONTROLLER
>
> protected
> def do_new
>   super
>   @record.exam_id = session[:exam_id]
> end
>
> El Miércoles, 16 de abril de 2014 19:23:11 Cláudio Forain escribió:
> > Sorry, I think I am using it wrongly. What I need is a way to use a
> session
> > value to check if a field may be edited or not. Something like this:
> >
> > On model enrollment:
> >
> > def my_field_authorized_for_create?
> >     if session[:exam_id] == x
> >         return true
> >     else
> >         return false
> >      end
> > end
> >
> > Is there a way to send a session (or params) value to the model? Thanks
> in
> > advance.
> >
> > On Wed, Apr 16, 2014 at 5:19 PM, Cláudio Forain
> <[email protected]>wrote:
> > > Im using ruby 2, rails 3.2 and AS 3.3.3 and it seems I can't get the
> > > controller method before_create_save to be triggered before a /new
> action
> > > to put some session attributes on my record.
> > >
> > > It looks pretty straightforward here (
> > > https://github.com/activescaffold/active_scaffold/wiki/API%3A-Create).
> > >
> > > I can't confirm, but when this projetct was on ruby 1.9.1, Rails 3.0
> and
> > > AS 3.3.0, it worked.
> > >
> > > Thanks in advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "ActiveScaffold : Ruby on Rails Gem" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/activescaffold.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/activescaffold.
For more options, visit https://groups.google.com/d/optout.

Reply via email to