Hi, Can someone please confirm that accessors cannot be used in ActionController to ''persist'' values between requests, at least, not without persisting to the database? I''m trying to minimize AJAX calls by storing information from certain of my calls for use by others later, but my attempts fail. My takeaway is that instance variables, as set by an accessor, are not stored between requests. Thanks for any comment, Lille -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2010-Jun-11 14:49 UTC
Re: newbie w. quick question on accessors in ActionController
On Jun 11, 3:43 pm, Lille <lille.pengu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > Can someone please confirm that accessors cannot be used in > ActionController to ''persist'' values between requests, at least, not > without persisting to the database? > > I''m trying to minimize AJAX calls by storing information from certain > of my calls for use by others later, but my attempts fail. My takeaway > is that instance variables, as set by an accessor, are not stored > between requests. >correct - fresh requests get a new instance of the controller class. In production the next request could very easily go to a different rails instance or even a different physical server if your app is running on several servers. Fred> Thanks for any comment, > > Lille-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
Thanks! On Jun 11, 10:49 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jun 11, 3:43 pm, Lille <lille.pengu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > > Can someone please confirm that accessors cannot be used in > > ActionController to ''persist'' values between requests, at least, not > > without persisting to the database? > > > I''m trying to minimize AJAX calls by storing information from certain > > of my calls for use by others later, but my attempts fail. My takeaway > > is that instance variables, as set by an accessor, are not stored > > between requests. > > correct - fresh requests get a new instance of the controller class. > In production the next request could very easily go to a different > rails instance or even a different physical server if your app is > running on several servers. > > Fred > > > Thanks for any comment, > > > Lille > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.