# Session Problem - Probably Simply Solution

**URL:** <https://www.ruby-forum.com/t/session-problem-probably-simply-solution/114285>\
**Category:** Rails\
**Created:** [September 10, 2007, 10:30pm UTC](https://www.ruby-forum.com/t/session-problem-probably-simply-solution/114285 "2007-09-10T22:30:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tommay\_Amstrad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/9fc348/32.png) [@Tommay\_Amstrad](https://www.ruby-forum.com/u/Tommay_Amstrad)\
**Post date:** [September 10, 2007, 10:30pm UTC](https://www.ruby-forum.com/t/session-problem-probably-simply-solution/114285/1 "2007-09-10T22:30:38Z")

</div>

I am having a problem saving something into a session variable and  
struggling to make any progress.

I have a login screen that I want to display differing logo’s  
dependent on the URL that people use.

For example, I have [http://127.0.0.1:3000/account/login/logo1](http://127.0.0.1:3000/account/login/logo1) or  
[http://127.0.0.1:3000/account/login/logo2](http://127.0.0.1:3000/account/login/logo2) and in the view I inspect  
params[:id] to determine the logo to display. This is working.

However, I now need to show the same logo on the logout screen, so I  
thought I would save the details in a session variable in my login  
method of AccountController. As follows:

session[:logo] = params[:id]

However this doesn’t work. When the view executes and i check  
session[:logo] it is empty. If I move the above line into the view  
then the session variable is saved, but it doesn’t seem the right  
place to be doing it.

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![Tommay\_Amstrad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/9fc348/32.png) [@Tommay\_Amstrad](https://www.ruby-forum.com/u/Tommay_Amstrad)\
**Post date:** [September 10, 2007, 10:34pm UTC](https://www.ruby-forum.com/t/session-problem-probably-simply-solution/114285/2 "2007-09-10T22:34:53Z")

</div>

you can insert this into your controller

before\_filter :select\_logo, :only =\> [:login, :logout]

and then create the function in your controller

def select\_logo  
@logo\_src = “image.jpg” # or whatever you need here 🙂  
end
