Hi, Can someone please tell me the preferred way to get a value from a session variable so that I can use it in a model? I have a user_id session variable. I created a "before_save" method in the model to set the model''s updated_by attribute to the user_id. The session isn''t available in the model. (not surprising, i guess) This has got to be a common requirement; What''s the right way to do it? thanks. _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 11/5/05, Larry White <ljw1001-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, > > Can someone please tell me the preferred way to get a value from a session > variable so that I can use it in a model? > > I have a user_id session variable. > I created a "before_save" method in the model to set the model''s > updated_by attribute to the user_id. > The session isn''t available in the model. (not surprising, i guess) > > This has got to be a common requirement; What''s the right way to do it? > > thanks. >Ya I just dug that one up myself. http://www.koziarski.net/archives/2005/07/16/environment _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I''m not sure this went through the first time. If so, apologies all around for re-posting. ---------- Forwarded message ---------- Hi, Can someone please tell me the preferred way to get a value from a session variable so that I can use it in a model? I have a user_id session variable. I created a "before_save" method in the model to set the model''s updated_by attribute to the user_id. The session isn''t available in the model. (not surprising, i guess) This has got to be a common requirement; What''s the right way to do it? thanks. _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
that should do it. thanks much. On 11/5/05, snacktime <snacktime-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > > On 11/5/05, Larry White <ljw1001-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi, > > > > Can someone please tell me the preferred way to get a value from a > > session variable so that I can use it in a model? > > > > I have a user_id session variable. > > I created a "before_save" method in the model to set the model''s > > updated_by attribute to the user_id. > > The session isn''t available in the model. (not surprising, i guess) > > > > This has got to be a common requirement; What''s the right way to do it? > > > > thanks. > > > > > Ya I just dug that one up myself. > > http://www.koziarski.net/archives/2005/07/16/environment > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails