Moving instance variable from partial to helper
Is _header.html.erb part of the layout? If so, i would advice you to move this logic to helper, if not all the controllers would need to set the @towns instance variable.

module ApplicationHelper
  def town_names
    Town.all.collect(&amp;:name)
  end
end


And in your view call the town_names. I think you want each name to be in an li element. I have changed the code accordingly.

&lt;% town_names.each do |name| %&gt;
     &lt;li class="name"&gt;
       &lt;h1&gt;&lt;%= link_to name, '#', id: "logo" %&gt;&lt;/h1&gt;
     &lt;/li&gt;
   &lt;% end %&gt;