how to pass session variable to model in RoR?

Posted by siulamvictor on Stack Overflow See other posts from Stack Overflow or by siulamvictor
Published on 2010-06-10T03:38:13Z Indexed on 2010/06/10 3:42 UTC
Read the original article Hit count: 210

I used a global variable in my app for passing information before. But I got a problem and thanks everyone here suggested me to store those data in session with database.

I tried, but I found that I can't access the session variable in Model. I googled and knew this is the Model normal behavior, RoR won't pass the session variable to Model.

So

  1. how to pass the value of the session variable into Models? or

  2. is there any other method for my use case? I need a variable storing a value, which is required in all MVCs, and should be independent between different concurrent users.

Thanks everyone. :)

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about mvc