I have multiple partials which may or may not be included in a given layout... and they often have javascript required for just the content of that partial... but I want the javascript loaded in the head.
so I'll generally have something like:
<html>
<head>
<title><%= @page_title %></title>
<%= yield :head %>
</head>
...etc
and in partial 1:
<% content_for :head do %>
<%= javascript_tag 'partial_one_js' %>
<% end %>
and in partial 2:
<% content_for :head do %>
<%= javascript_tag 'partial_two_js' %>
<% end %>
But whichever is defined second blows away the content coming from the first.
There is no way to combine the partials.
I'd like to be able to concatenate them without doing something totally hacky. It also has to work if only one or neither is present.
... and I'd especially rather avoid:
<html>
<head>
<title><%= @page_title %></title>
<%= yield :head_one %>
<%= yield :head_two %>
</head>
... ick
So... does anybody have a solution?