Session Problem - Probably Simply Solution

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 or
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?

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 :slight_smile:
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs