I want to display the top three schools (in @top_schools array) in my
view which is in a column on the left on the site. This is the same for
all views and all controllers so naturally it’s in the layout file in
the partial _lcol.html.erb
The problem is, being in a partial it’s displayed for whatever action it
is in. I don’t know where to put it in the controller. Putting it in the
index action of the Schools controller only displays the array for that
action. How do I make it universal aside from putting the business logic
right into the view?
index action of the Schools controller only displays the array for
that
action. How do I make it universal aside from putting the business
logic
right into the view?
<% for school in @top_schools %>
<%= school.title %>
<% end %>
Have a look at this article for several ideas on how to deal with
repeating and unique partials and layouts…