I want to add a display of personal links to my users. Is there a way
I can call a .find method when a partial is rendered?
This is in my website’s template:
<% if !session[:user_id].nil? %>
<%= render :partial => “/layouts/personal_links” %>
<% end %>
The contents of the partial are:
- My Links
<% for links in @personal_links %>
- <%= link_to links.name, links.url %> <% end %>
The trick is, I need to set @personal_links (or something similar),
but it will only be valid when a user is logged in. What is the best
way to accomplish this? A session variable of some sort?