title: Rails: Dry content_for before yield
body: <p>I have a partial that need to include some js: view/main/<strong>_address_slider.html.erb</strong></p>
  
  <pre><code>&lt;% content_for :scripts  do %&gt;
  &lt;%= javascript_include_tag 'swipeslider/dist/idangerous.swiper.min' %&gt;
  &lt;%= javascript_include_tag 'fineuploader' %&gt;
  &lt;% end %&gt;
  ...
  </code></pre>
  
  <p>I have a testing page: view/main/<strong>test_partial_address_slider.html.erb</strong></p>
  
  <pre><code>&lt;% content_for :scripts  do %&gt;
  &lt;%= javascript_include_tag 'swipeslider/dist/idangerous.swiper.min' %&gt;
  &lt;%= javascript_include_tag 'mycustomplugin' %&gt;
  &lt;% end %&gt;
  &lt;% render 'address_slider' %&gt;
  </code></pre>
  
  <p>I have a specific test layout: view/layouts/<strong>test.html.erb</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;meta name="description" content="Social Network"&gt;
  &lt;meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"&gt;
  &lt;title&gt;&lt;%= @meta_title %&gt;&lt;/title&gt;
  &lt;%= yield :meta %&gt;
  &lt;%= yield :styles %&gt;
  &lt;%= yield :scripts %&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div id="page"&gt;
  &lt;%= display_flash %&gt;
  &lt;%= yield %&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Than in my controller: controllers/main_controller</p>
  
  <pre><code>def test_partial_address_slider
  render "test_partial_address_slider", layout: "test"
  end
  </code></pre>
  
  <p>The rendered page contains the js import of swipeslider/dist/idangerous.swiper.min twice.</p>
  
  <pre><code>&lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;meta name="description" content="Social Network"&gt;
  &lt;meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"&gt;
  &lt;title&gt;....&lt;/title&gt; 
  &lt;script src="/assets/swipeslider/dist/idangerous.swiper.min.js?body=1" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="/assets/swipeslider/dist/idangerous.swiper.min.js?body=1" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="/assets/fineuploader.js?body=1" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="/assets/mycustomplugin.js?body=1" type="text/javascript"&gt;&lt;/script&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p>Can I remove the duplicate from the content_for before the yield in my layout?</p>