Topic: Need a little help with sessions

Hi all,

I'm making a app that need to check the session[:valid] is true so to render :action2 if not redirect_to /controller/action1. This is what i have done so far:

controller

def index
    @session ||= session[:valid] = nil
  end 

  def action1
 
  end

  def action2
      @session ? render(:action2) : redirect_to(:action1)
  end

routes are:

  match '/controller/action1' => 'controller#action1', :as => 'action1'
  match '/controller/action2' => 'controller#action2', :as => 'action2'

but the issue is that when going to /controller/action2 it renders action2 and not redirects to action1. What am i doing wrong.

Thanks

Re: Need a little help with sessions

Update:

I have got it to work now thanks anyway.