Where to initialize session variables?


#1

Hi all,

I would like to initialize some session variables when the user visits
the app for the first time. Currently I do it in an application
before_filter (escaped if the session already exists), but that occurs
for each request, it’s dirty.

Do you have any better solution?

Jej


#2

The solution you have seems like a fine answer to me. Simple,
standard, and should be pretty easy for any incoming developer to
understand. If youve got a method like the following then it probably
isn’t a big performance drain either.

before_filter :intialize_session_stuff
def intialize_session_stuff
return if session_stuff_is_already_set?

end