def validate
if document_id == (@@document_id || session[:document_id])
true
else
false
end
end
it works some time , some time uninitialized constant error for class
variable and session token is null when I refresh the browser.
I know session variable stored in server side but when I request
multiple times it returns null value.
i am also using before filter for that task, but no use.
If you want a variable that has to be determined once for each request
but is available in all actions then before_filter is the way to go.
If you want a variable that persists from request to request (such as
current logged in user) then the session is what you want.
Give us more detail on exactly what you are trying to achieve.