<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title> File: README — Documentation by YARD 0.7.2 </title> <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" /> <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" /> <script type="text/javascript" charset="utf-8"> relpath = ''; if (relpath != '') relpath += '/'; </script> <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script> <script type="text/javascript" charset="utf-8" src="js/app.js"></script> </head> <body> <script type="text/javascript" charset="utf-8"> if (window.top.frames.main) document.body.className = 'frames'; </script> <div id="header"> <div id="menu"> <a href="_index.html" title="Index">Index</a> » <span class="title">File: README</span> <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div> </div> <div id="search"> <a id="class_list_link" href="#">Class List</a> <a id="method_list_link" href="#">Method List</a> <a id="file_list_link" href="#">File List</a> </div> <div class="clear"></div> </div> <iframe id="search_frame"></iframe> <div id="content"><div id='filecontents'><h1>Attrtastic</h1> <p>Attrtastic is simple view helper which can be used to create index/show pages for any objects (for example Active Model objects). It helps you display all present attributes of object.</p> <p>If you need compatibility with Rails 2.x, then please install version 0.2.2 of this gem.</p> <h2>Using</h2> <p>Install the gem:</p> <pre class="code"><span class='id gem'>gem</span> <span class='id install'>install</span> <span class='id attrtastic'>attrtastic</span> </pre> <p>Add to your <code>Gemfile</code>:</p> <pre class="code"><span class='id gem'>gem</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>attrtastic</span><span class='tstring_end'>"</span></span> </pre> <p>And use in your views, for example in user/show.erb</p> <pre class="code"><%= semantic_attributes_for @user do |attr| %> <%= attr.attributes "User" do %> <%= attr.attribute :first_name %> <%= attr.attribute :last_name %> <%= attr.attribute :avatar do %> <%= image_tag @user.avatar.url %> <% end %> <% end %> <%= attr.attributes "Contact" do %> <%= attr.attribute :email %> <%= attr.attribute :tel %> <%= attr.attribute :fax %> <% end %> <% end %> </pre> <p>By default attributes which returns <code>#blank?</code> value are ommited, unless <code>:display_empty => true</code> is added to <code>#attribute</code>.</p> <h2>Note on Patches/Pull Requests</h2> <ul> <li>Fork the project.</li> <li>Make your feature addition or bug fix.</li> <li>Add tests for it. This is important so I don't break it in a future version unintentionally.</li> <li>Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)</li> <li>Send me a pull request. Bonus points for topic branches.</li> </ul> <h2>Copyright</h2> <p>Copyright (c) 2009-2011 Boruta MirosÅ‚aw. See LICENSE for details.</p></div></div> <div id="footer"> Generated on Tue Aug 16 11:49:20 2011 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> 0.7.2 (ruby-1.9.2). </div> </body> </html>