Cookies in custom class

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.

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

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 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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs