Read session in a view

I would like to be able to hide a edit and add link on a index page
based on if a user is logged in or not. is this possible and if so
could you help?

Set the user id in session and use that in your index page to hide or
enable links.

<% if session[:user_id] %>
   //show or hide links
<% end %>