Hello! I have created a custom class in my RoR application and put it into lib/ folder. How can I access cookies and session variables in this class? I need to set and read variables from them. Best regards. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 4 Sep 2008, at 13:49, Konstantin wrote:> > Hello! > > I have created a custom class in my RoR application and put it into > lib/ > folder. > How can I access cookies and session variables in this class? I need > to > set and read variables from them. >You can''t sensibly. cookies and session are instance methods of controllers. Fred> Best regards. > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Maybe I can inherit my class from controller? I really need to make a stand alone class to operate with session and cookie variables On 4 сент, 15:51, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 4 Sep 2008, at 13:49, Konstantin wrote: > > > > > Hello! > > > I have created a custom class in my RoR application and put it into > > lib/ > > folder. > > How can I access cookies and session variables in this class? I need > > to > > set and read variables from them. > > You can''t sensibly. cookies and session are instance methods of > controllers. > > Fred > > > Best regards.--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---
On 4 Sep 2008, at 14:24, Konstantin wrote:> > Maybe I can inherit my class from controller?wouldn''t make any difference - you wouldn''t be that instance of the controller.> > I really need to make a stand alone class to operate with session and > cookie variables >Just pass session/cookie parameters through when you call stuff in your magic. if you have to, have a look at http://m.onkey.org/2007/10/17/how-to-access-session-cookies-params-request-in-model Fred> On 4 сент, 15:51, Frederick Cheung <frederick.che...@gmail.com> > wrote: >> On 4 Sep 2008, at 13:49, Konstantin wrote: >> >> >> >>> Hello! >> >>> I have created a custom class in my RoR application and put it into >>> lib/ >>> folder. >>> How can I access cookies and session variables in this class? I need >>> to >>> set and read variables from them. >> >> You can''t sensibly. cookies and session are instance methods of >> controllers. >> >> Fred >> >>> Best regards. > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---