Topic: persistent variable

Sorry fopr that stupid question,  but I am wondering how I could create a persistent variable for a user session - a variable which survives a redirection f.e.

My first idea was to use a global var, but that would mean every user is affected, right?
So what can I do?l

Last edited by Percy2000 (2010-08-13 09:46:39)

Re: persistent variable

Best to grab something like RESTFul_authentication plugin,  it will handle that for you.

Last edited by BradHodges (2010-08-13 20:07:58)

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: persistent variable

that's what I did - and it is quite elegant. One extends the session and adds some vars - that is all.

My problem remains though, since I want to keep variables before the session is established.
Any idea?

Re: persistent variable

I don't know of anyway to create a persistent piece of user specific data OTHER than by using a session.

But I'm not sure of exactly what you're after.  Can this data be hard coded?  I mean you can hard code values into your Rails app, and they're 'presistent', but global to all users,  is that what you mean?

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: persistent variable

Hi!

I'm not quite sure what you mean by 'before the session is established'. Do you mean before the user is logged in?
Because that shouldn't matter... Any variable you store in the session hash survives a redirection...

But if that's not what you're looking for and you don't have a session until a certain point - whatever the reason - you could do something like storing specific data in a db table with the IP adress of the client the request comes from... though it's quite some overhead doing stuff like that... and if the clients provider uses dynamic ip adresses it could happen, that the first request of the client has one ip and the next another...

Well, hope that helps somehow!

Vapire