On Tue, Oct 5, 2010 at 5:43 PM, Jim Burgess <[email protected]> wrote:

> Radhames Brito wrote:
> > save it in the session hash on validation
>
> Hi,
>
> Thanks for the reply.
> Did I understand you correctly, that you are suggesting setting a
> session variable in the model (where my validation is taking place)
> which I can then pass to the controller?
>
> I didn't know that that was possible.
> Any hacks around this seem to be regarded as bad practice:
> http://www.ruby-forum.com/topic/160769
>
> If I have misunderstood you please let me know.
>
>
are you use to using the flash? like flash[:notice]? well the session[:]
object is just like it, it exits across request and it exist in the context
of th user, that is, each user has its on session object. The difference is
that what you store in the flash is deleted after one request but what you
store in session is there untill the session is reset or you delete the
object. Is often used in ecomerce app to store the cart like this
session[:cart], and you can store anything in it. In fact storing options
can be set to make it store in the DB.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to