<% if content_for :before_javascript_libraries %>
  <% Refinery.deprecate "content_for :before_javascript_libraries", :when => '2.2', :replacement => "content_for :javascripts" %>
  <% content_for :javascripts, yield(:before_javascript_libraries) %>
<% end %>

<% if content_for :javascript_libraries %>
  <% Refinery.deprecate "content_for :javascript_libraries", :when => '2.2', :replacement => "content_for :javascripts" %>
  <% content_for :javascripts, yield(:javascript_libraries) %>
<% end %>

<% if content_for :after_javascript_libraries %>
  <% Refinery.deprecate "content_for :after_javascript_libraries", :when => '2.2', :replacement => "content_for :javascripts" %>
  <% content_for :javascripts, yield(:after_javascript_libraries) %>
<% end %>


<%= javascript_include_tag 'application' %>
<%= yield :javascripts -%>
<% if request.env['HTTP_USER_AGENT'] =~ /MSIE/ %>
  <!--[if lt IE 7 ]>
    <%= javascript_include_tag 'dd_belatedpng' %>
    <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script>
  <![endif]-->
<% end %>

<% if content_for? :before_javascript_libraries %>
  <% Refinery.deprecate "content_for :before_javascript_libraries", :when => '2.2', :replacement => "content_for :javascripts" %>
  <% content_for :javascripts, yield(:before_javascript_libraries) %>
<% end %>

<% if content_for? :javascript_libraries %>
  <% Refinery.deprecate "content_for :javascript_libraries", :when => '2.2', :replacement => "content_for :javascripts" %>
  <% content_for :javascripts, yield(:javascript_libraries) %>
<% end %>

<% if content_for? :after_javascript_libraries %>
  <% Refinery.deprecate "content_for :after_javascript_libraries", :when => '2.2', :replacement => "content_for :javascripts" %>
  <% content_for :javascripts, yield(:after_javascript_libraries) %>
<% end %>

<%= javascript_include_tag 'application' %>
<%= yield :javascripts -%>
<% if request.env['HTTP_USER_AGENT'] =~ /MSIE/ %>
  <!--[if lt IE 7 ]>
    <%= javascript_include_tag 'dd_belatedpng' %>
    <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script>
  <![endif]-->
<% end %>

Use content_for? (instead of content_for) to check if any content has been captured.
Use content_for? (instead of content_for) to check if any content has been captured.
