Issue with session variables


#1

I had (at one time) got this thing working but it doesnt’ seem to work
any more. I am trying to display a specific user menu depending on the
session variable. Here is what I have:

<% for @role in @session[:user][:role] %>
<% if @role.role_id == ‘1’ %>

  • <% link_to “Create Resource”, :controller =>
    “admin”, :action => “new_resource” %>

  • <% link_to “View New Resources”, :controller =>
    “admin”, :action => “list_new_resources” %>

  • <% link_to “View All Resources”, :controller =>
    “admin”, :action => “list_resources” %>

  • <% link_to “Users”, :controller => “admin”, :action
    => “list_users” %>

  • <% elsif @role.role_id == ‘2’ %>
  • <% link_to “Create Resource”, :controller =>
    “admin”, :action => “new_resource” %>

  • <% link_to “View New Resources”, :controller =>
    “admin”, :action => “list_new_resources” %>

  • <% link_to “View All Resources”, :controller =>
    “admin”, :action => “list_resources” %>

  • <% elsif @role.role_id == ‘3’ %>
  • <% link_to “Create Resource”, :controller =>
    “admin”, :action => “new_resource” %>

  • <% end %>
    <% end %>

    When I do @session[:user][:role].inspect I get:

    [#“Administrator”, “info”=>“Can do anything.”, “role_id”=>“1”,
    “id”=>“1”, “user_id”=>“1”}>]

    Which is what I suspect. But my menu is blank and nothing is displayed.

    Thanks for the help.

    Seth