<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: helper code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 24 Jul 2008 03:15:31 GMT</pubDate>
    <description>DZone Snippets: helper code</description>
    <item>
      <title>open_body_tag</title>
      <link>http://snippets.dzone.com/posts/show/4726</link>
      <description>&lt;code&gt;&lt;br /&gt;  #creates a body tag uniquely indentifying this page&lt;br /&gt;  #takes an options Hash with two keys:&lt;br /&gt;  #&lt;br /&gt;  #&lt;tt&gt;id&lt;/tt&gt;::        string that will be used as the body's ID. defaults to &lt;tt&gt;controller.controller_name.singularize&lt;/tt&gt;&lt;br /&gt;  #&lt;tt&gt;classes&lt;/tt&gt;::   an Array of class names. defaults to &lt;tt&gt;[params[:action]]&lt;/tt&gt;&lt;br /&gt;  #&lt;br /&gt;  #Examples:&lt;br /&gt;  #&lt;br /&gt;  # in HomeController#index:&lt;br /&gt;  #&lt;br /&gt;  # &lt;%= open_body_tag %&gt;&lt;br /&gt;  # =&gt; &lt;body id='home' class='index'&gt;&lt;br /&gt;  #&lt;br /&gt;  # &lt;%= open_body_tag(:id =&gt; 'foo') %&gt;&lt;br /&gt;  # =&gt; &lt;body id='foo' class='index'&gt;&lt;br /&gt;  #&lt;br /&gt;  # &lt;%= open_body_tag(:id =&gt; 'foo', :classes =&gt; %w(one two)) %&gt;&lt;br /&gt;  # =&gt; &lt;body id='foo' class='one two'&gt;&lt;br /&gt;  def open_body_tag(options = { :id =&gt; controller.controller_name.singularize, :classes =&gt; [params[:action]] })&lt;br /&gt;    "&lt;body id='#{options[:id]}' class='#{options[:classes].join(' ')}'&gt;"&lt;br /&gt;  end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 01 Nov 2007 19:24:01 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4726</guid>
      <author>jnewland (Jesse Newland)</author>
    </item>
  </channel>
</rss>
