On 6 October 2010 22:07, radhames brito <rbri...@gmail.com> wrote: > > > On Tue, Oct 5, 2010 at 5:43 PM, Jim Burgess <li...@ruby-forum.com> 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.
I think Jim is querying whether one can access the session variable from within the model, and even if one can, whether one should. 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.