Monday, October 17, 2011

Re: [Rails] Re: Getting a variable defined in new action in create action

On 17 October 2011 08:53, Nikhil Goyal <goyal.nikhil89@gmail.com> wrote:
>
>
> On Oct 16, 1:47 pm, Colin Law <clan...@googlemail.com> wrote:
>
>> You could save it in the session.
>>
>> Colin
>
> Can you show me with a example, railsguide does not has very good
> documentation on sessions. I do not understand, where to initialize
> sessions and how to use.

I think http://guides.rubyonrails.org/action_controller_overview.html#session
pretty much covers it. It is very simple as can be seen in the
examples there. Just set a value in the session in the controller
(something like session[:current_user_id] = user.id for example) and
access it again in a later action. Initially at least you can just
leave all the session config stuff at default and just go ahead and
use it.

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate