<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Cory O&#039;Daniel - These are just words &#187; Software</title>
	<atom:link href="http://coryodaniel.com/index.php/category/software/feed/" rel="self" type="application/rss+xml" />
	<link>http://coryodaniel.com</link>
	<description>Software development, thoughts, and randomness</description>
	<lastBuildDate>Thu, 17 Nov 2011 21:18:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Rails 3 Easy Search forms using SimpleForm and ActiveModel</title>
		<link>http://coryodaniel.com/index.php/2011/11/17/rails-3-easy-search-forms-using-simpleform-and-activemodel/</link>
		<comments>http://coryodaniel.com/index.php/2011/11/17/rails-3-easy-search-forms-using-simpleform-and-activemodel/#comments</comments>
		<pubDate>Thu, 17 Nov 2011 21:15:17 +0000</pubDate>
		<dc:creator>Cory O'Daniel</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[active_model]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[simple_form]]></category>

		<guid isPermaLink="false">http://coryodaniel.com/?p=649</guid>
		<description><![CDATA[For the sites I'm currently working on I have search pages all over the place for different resources, especially on the backend. In the past I would forego using form builders and just do some HTML to make a form GET the data. I hate HTML.
So I did some poking around to see what I [...]]]></description>
			<content:encoded><![CDATA[<p>For the sites I'm currently working on I have search pages all over the place for different resources, especially on the backend. In the past I would forego using form builders and just do some HTML to make a form GET the data. I hate HTML.</p>
<p>So I did some poking around to see what I could do to DRY up my time on creating these search forms. My first thought was to create a Search class and use active model, but it sucked because I everytime I had to create a new form I had to come into the search class and add a bunch of attr_accessors for all of the search fields. That sucks.</p>
<p>So I decided to mix it up with OpenStruct and ActiveModel</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'ostruct'</span>
<span style="color:#9966CC; font-weight:bold;">class</span> Search <span style="color:#006600; font-weight:bold;">&lt;</span> OpenStruct
  <span style="color:#9966CC; font-weight:bold;">include</span> <span style="color:#6666ff; font-weight:bold;">ActiveModel::Validations</span>
  <span style="color:#9966CC; font-weight:bold;">include</span> <span style="color:#6666ff; font-weight:bold;">ActiveModel::Conversion</span>
  extend  <span style="color:#6666ff; font-weight:bold;">ActiveModel::Naming</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> initialize<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">*</span>args<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">super</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> persisted? ; <span style="color:#0000FF; font-weight:bold;">false</span> ; <span style="color:#9966CC; font-weight:bold;">end</span>;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Now I use this one model for searching of all of my resources.</p>
<p>I create the form super easily with SimpleForm:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">= simple_form_for<span style="color:#006600; font-weight:bold;">&#40;</span>@search, url: my_cool_path<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>, html:<span style="color:#006600; font-weight:bold;">&#123;</span>method: <span style="color:#ff3333; font-weight:bold;">:get</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>f<span style="color:#006600; font-weight:bold;">|</span>
  = f.<span style="color:#9900CC;">input</span> <span style="color:#ff3333; font-weight:bold;">:text</span>
  = f.<span style="color:#CC0066; font-weight:bold;">select</span> <span style="color:#ff3333; font-weight:bold;">:category</span>,  <span style="color:#6666ff; font-weight:bold;">Product::CATEGORIES</span>
  = f.<span style="color:#9900CC;">input</span> <span style="color:#ff3333; font-weight:bold;">:minimum_price</span>
  = f.<span style="color:#9900CC;">input</span> <span style="color:#ff3333; font-weight:bold;">:maximum_price</span>
  = f.<span style="color:#9900CC;">submit</span> <span style="color:#ff3333; font-weight:bold;">:search</span></pre></div></div>

<p>In your controller you are going to get a params[:search] hash with :text, :category, :minimum_price, :maximum_price.</p>
<p>Want to persist that search across page reloads?</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> ApplicationController <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActionController::Base</span>
  before_filter <span style="color:#ff3333; font-weight:bold;">:persist_search</span>
  protected
  <span style="color:#9966CC; font-weight:bold;">def</span> persist_search
    <span style="color:#0066ff; font-weight:bold;">@search</span> = Search.<span style="color:#9900CC;">new</span> params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:search</span><span style="color:#006600; font-weight:bold;">&#93;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Now you'll have a Search object in all of your requests with your user's search params. Use it as you will to return them the resources they are looking for.</p>
<p>*Side note*<br />
I use the above logic for all of my resources, until one of my resources has a requirement like a validation. Then I break it into something like FlightSearch:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'ostruct'</span>
<span style="color:#008000; font-style:italic;"># ostruct for that lazy goodness</span>
<span style="color:#9966CC; font-weight:bold;">class</span> FlightSearch <span style="color:#006600; font-weight:bold;">&lt;</span> OpenStruct
  <span style="color:#008000; font-style:italic;"># Get activemodel in there for all its cool functionality like model name, pluralization, validation, yada yada yada</span>
  <span style="color:#9966CC; font-weight:bold;">include</span> <span style="color:#6666ff; font-weight:bold;">ActiveModel::Validations</span>
  <span style="color:#9966CC; font-weight:bold;">include</span> <span style="color:#6666ff; font-weight:bold;">ActiveModel::Conversion</span>
  extend  <span style="color:#6666ff; font-weight:bold;">ActiveModel::Naming</span>
&nbsp;
  validates_presence_of <span style="color:#ff3333; font-weight:bold;">:origin_airport</span>, <span style="color:#ff3333; font-weight:bold;">:destination_airport</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># you can do cool things here, just make sure you call super so ostruct </span>
  <span style="color:#008000; font-style:italic;"># takes all those hash params and makes them methods</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> initialize<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">*</span>args<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">super</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># ActiveModel needs to know that this wasn't persisted.</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> persisted? ; <span style="color:#0000FF; font-weight:bold;">false</span> ; <span style="color:#9966CC; font-weight:bold;">end</span>;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p align="left"><a class="tt" href="http://twitter.com/home/?status=Rails+3+Easy+Search+forms+using+SimpleForm+and+ActiveModel+http://coryodaniel.com/?p=649" title="Post to Twitter"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-twitter-big2.png" alt="Post to Twitter" /></a> <a class="tt" href="http://digg.com/submit?url=http://coryodaniel.com/index.php/2011/11/17/rails-3-easy-search-forms-using-simpleform-and-activemodel/&amp;title=Rails+3+Easy+Search+forms+using+SimpleForm+and+ActiveModel" title="Post to Digg"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-digg-big2.png" alt="Post to Digg" /></a> <a class="tt" href="http://www.facebook.com/share.php?u=http://coryodaniel.com/index.php/2011/11/17/rails-3-easy-search-forms-using-simpleform-and-activemodel/&amp;t=Rails+3+Easy+Search+forms+using+SimpleForm+and+ActiveModel" title="Post to Facebook"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-facebook-big2.png" alt="Post to Facebook" /></a> <a class="tt" href="http://reddit.com/submit?url=http://coryodaniel.com/index.php/2011/11/17/rails-3-easy-search-forms-using-simpleform-and-activemodel/&amp;title=Rails+3+Easy+Search+forms+using+SimpleForm+and+ActiveModel" title="Post to Reddit"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-reddit-big2.png" alt="Post to Reddit" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://coryodaniel.com/index.php/2011/11/17/rails-3-easy-search-forms-using-simpleform-and-activemodel/&amp;title=Rails+3+Easy+Search+forms+using+SimpleForm+and+ActiveModel" title="Post to StumbleUpon"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-su-big2.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://coryodaniel.com/index.php/2011/11/17/rails-3-easy-search-forms-using-simpleform-and-activemodel/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Airbrake&#8217;s Javascript Error Reporting and Google</title>
		<link>http://coryodaniel.com/index.php/2011/10/17/airbrakes-javascript-error-reporting-and-google/</link>
		<comments>http://coryodaniel.com/index.php/2011/10/17/airbrakes-javascript-error-reporting-and-google/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 22:46:30 +0000</pubDate>
		<dc:creator>Cory O'Daniel</dc:creator>
				<category><![CDATA[Industry News]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[adsense]]></category>
		<category><![CDATA[airbrake]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://coryodaniel.com/?p=646</guid>
		<description><![CDATA[So today I turned on the experimental JavaScript Error Reporting in Airbrake today. Within about 5 minutes my inbox was bombarded.
Looks like Google the masters of writing software for everything are very diligent in testing their code.
I have a feeling I'm going to have to add a lot of exclusions to my "Global Error Classes" [...]]]></description>
			<content:encoded><![CDATA[<p>So today I turned on the experimental JavaScript Error Reporting in <a href="http://airbrakeapp.com">Airbrake</a> today. Within about 5 minutes my inbox was bombarded.</p>
<p>Looks like Google the masters of writing software for everything are very diligent in testing their code.</p>
<p>I have a feeling I'm going to have to add a lot of exclusions to my "Global Error Classes" list.</p>
<p><img src="http://static.coryodaniel.com/stuff/google_airbrake.png" /></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Airbrake%E2%80%99s+Javascript+Error+Reporting+and+Google+http://coryodaniel.com/?p=646" title="Post to Twitter"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-twitter-big2.png" alt="Post to Twitter" /></a> <a class="tt" href="http://digg.com/submit?url=http://coryodaniel.com/index.php/2011/10/17/airbrakes-javascript-error-reporting-and-google/&amp;title=Airbrake%E2%80%99s+Javascript+Error+Reporting+and+Google" title="Post to Digg"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-digg-big2.png" alt="Post to Digg" /></a> <a class="tt" href="http://www.facebook.com/share.php?u=http://coryodaniel.com/index.php/2011/10/17/airbrakes-javascript-error-reporting-and-google/&amp;t=Airbrake%E2%80%99s+Javascript+Error+Reporting+and+Google" title="Post to Facebook"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-facebook-big2.png" alt="Post to Facebook" /></a> <a class="tt" href="http://reddit.com/submit?url=http://coryodaniel.com/index.php/2011/10/17/airbrakes-javascript-error-reporting-and-google/&amp;title=Airbrake%E2%80%99s+Javascript+Error+Reporting+and+Google" title="Post to Reddit"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-reddit-big2.png" alt="Post to Reddit" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://coryodaniel.com/index.php/2011/10/17/airbrakes-javascript-error-reporting-and-google/&amp;title=Airbrake%E2%80%99s+Javascript+Error+Reporting+and+Google" title="Post to StumbleUpon"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-su-big2.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://coryodaniel.com/index.php/2011/10/17/airbrakes-javascript-error-reporting-and-google/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using devise&#8217;s scoped url helpers in Cucumber; new_registration_path, new_session_path</title>
		<link>http://coryodaniel.com/index.php/2011/10/07/using-devises-scoped-url-helpers-in-cucumber-new_registration_path-new_session_path/</link>
		<comments>http://coryodaniel.com/index.php/2011/10/07/using-devises-scoped-url-helpers-in-cucumber-new_registration_path-new_session_path/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 20:40:36 +0000</pubDate>
		<dc:creator>Cory O'Daniel</dc:creator>
				<category><![CDATA[BDD]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[RubyDevelopment]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[devise]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://coryodaniel.com/?p=642</guid>
		<description><![CDATA[You can use devise's scoped url helpers from cucumber, but you have to use them by their real Url Helper method names:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module NavigationHelpers
  def path_to&#40;page_name&#41;
    case page_name
    when /the sign up page/
      # dont use the helper's helper
      [...]]]></description>
			<content:encoded><![CDATA[<p>You can use devise's scoped url helpers from cucumber, but you have to use them by their real Url Helper method names:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">module</span> NavigationHelpers
  <span style="color:#9966CC; font-weight:bold;">def</span> path_to<span style="color:#006600; font-weight:bold;">&#40;</span>page_name<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">case</span> page_name
    <span style="color:#9966CC; font-weight:bold;">when</span> <span style="color:#006600; font-weight:bold;">/</span>the sign up page<span style="color:#006600; font-weight:bold;">/</span>
      <span style="color:#008000; font-style:italic;"># dont use the helper's helper</span>
      <span style="color:#008000; font-style:italic;"># new_registration_path(:user)      </span>
&nbsp;
      <span style="color:#008000; font-style:italic;"># use the underlying url helper</span>
      new_user_registration_path
    <span style="color:#9966CC; font-weight:bold;">when</span> <span style="color:#006600; font-weight:bold;">/</span>the sign <span style="color:#9966CC; font-weight:bold;">in</span> page<span style="color:#006600; font-weight:bold;">/</span>
      <span style="color:#008000; font-style:italic;"># dont use the helper's helper</span>
      <span style="color:#008000; font-style:italic;"># new_session_path(:user)      </span>
&nbsp;
      <span style="color:#008000; font-style:italic;"># use the underlying url helper</span>
      new_user_session_path
    <span style="color:#9966CC; font-weight:bold;">else</span>
      <span style="color:#008000; font-style:italic;">#...yada, yada</span></pre></td></tr></table></div>

<p align="left"><a class="tt" href="http://twitter.com/home/?status=Using+devise%E2%80%99s+scoped+url+helpers+in+Cucumber%3B+new_registration_path%2C+new_session_path+http://coryodaniel.com/?p=642" title="Post to Twitter"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-twitter-big2.png" alt="Post to Twitter" /></a> <a class="tt" href="http://digg.com/submit?url=http://coryodaniel.com/index.php/2011/10/07/using-devises-scoped-url-helpers-in-cucumber-new_registration_path-new_session_path/&amp;title=Using+devise%E2%80%99s+scoped+url+helpers+in+Cucumber%3B+new_registration_path%2C+new_session_path" title="Post to Digg"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-digg-big2.png" alt="Post to Digg" /></a> <a class="tt" href="http://www.facebook.com/share.php?u=http://coryodaniel.com/index.php/2011/10/07/using-devises-scoped-url-helpers-in-cucumber-new_registration_path-new_session_path/&amp;t=Using+devise%E2%80%99s+scoped+url+helpers+in+Cucumber%3B+new_registration_path%2C+new_session_path" title="Post to Facebook"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-facebook-big2.png" alt="Post to Facebook" /></a> <a class="tt" href="http://reddit.com/submit?url=http://coryodaniel.com/index.php/2011/10/07/using-devises-scoped-url-helpers-in-cucumber-new_registration_path-new_session_path/&amp;title=Using+devise%E2%80%99s+scoped+url+helpers+in+Cucumber%3B+new_registration_path%2C+new_session_path" title="Post to Reddit"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-reddit-big2.png" alt="Post to Reddit" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://coryodaniel.com/index.php/2011/10/07/using-devises-scoped-url-helpers-in-cucumber-new_registration_path-new_session_path/&amp;title=Using+devise%E2%80%99s+scoped+url+helpers+in+Cucumber%3B+new_registration_path%2C+new_session_path" title="Post to StumbleUpon"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-su-big2.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://coryodaniel.com/index.php/2011/10/07/using-devises-scoped-url-helpers-in-cucumber-new_registration_path-new_session_path/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Application stuck installing on iPhone</title>
		<link>http://coryodaniel.com/index.php/2011/04/14/application-stuck-installing-on-iphone/</link>
		<comments>http://coryodaniel.com/index.php/2011/04/14/application-stuck-installing-on-iphone/#comments</comments>
		<pubDate>Thu, 14 Apr 2011 19:49:04 +0000</pubDate>
		<dc:creator>Cory O'Daniel</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[installer]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://coryodaniel.com/index.php/2011/04/14/application-stuck-installing-on-iphone/</guid>
		<description><![CDATA[I was trying to install an app last night while buzzed in a shady dive bar with no signal. 
It took forever and eventually my phone gave up. I figured when I was on a decent network it'd continue installing. Nopecity. 
Today the app has about half the meter full. 
How do you fix it? [...]]]></description>
			<content:encoded><![CDATA[<p>I was trying to install an app last night while buzzed in a shady dive bar with no signal. </p>
<p>It took forever and eventually my phone gave up. I figured when I was on a decent network it'd continue installing. Nopecity. </p>
<p>Today the app has about half the meter full. </p>
<p>How do you fix it? </p>
<p>I tried clicking. Nope. Deleting? Nope - it was disabled. </p>
<p>Reboot the phone? Yea!  It prompted me for my password and all is good. </p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Application+stuck+installing+on+iPhone+http://coryodaniel.com/?p=625" title="Post to Twitter"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-twitter-big2.png" alt="Post to Twitter" /></a> <a class="tt" href="http://digg.com/submit?url=http://coryodaniel.com/index.php/2011/04/14/application-stuck-installing-on-iphone/&amp;title=Application+stuck+installing+on+iPhone" title="Post to Digg"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-digg-big2.png" alt="Post to Digg" /></a> <a class="tt" href="http://www.facebook.com/share.php?u=http://coryodaniel.com/index.php/2011/04/14/application-stuck-installing-on-iphone/&amp;t=Application+stuck+installing+on+iPhone" title="Post to Facebook"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-facebook-big2.png" alt="Post to Facebook" /></a> <a class="tt" href="http://reddit.com/submit?url=http://coryodaniel.com/index.php/2011/04/14/application-stuck-installing-on-iphone/&amp;title=Application+stuck+installing+on+iPhone" title="Post to Reddit"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-reddit-big2.png" alt="Post to Reddit" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://coryodaniel.com/index.php/2011/04/14/application-stuck-installing-on-iphone/&amp;title=Application+stuck+installing+on+iPhone" title="Post to StumbleUpon"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-su-big2.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://coryodaniel.com/index.php/2011/04/14/application-stuck-installing-on-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cucumber.yml was found, but could not be parsed. Please refer to cucumber&#8217;s documentation on correct profile usage.</title>
		<link>http://coryodaniel.com/index.php/2011/04/12/cucumber-yml-was-found-but-could-not-be-parsed-please-refer-to-cucumbers-documentation-on-correct-profile-usage/</link>
		<comments>http://coryodaniel.com/index.php/2011/04/12/cucumber-yml-was-found-but-could-not-be-parsed-please-refer-to-cucumbers-documentation-on-correct-profile-usage/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 16:24:33 +0000</pubDate>
		<dc:creator>Cory O'Daniel</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[RubyDevelopment]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rerun]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://coryodaniel.com/?p=623</guid>
		<description><![CDATA[Yeah, I got that message today and wasted about 30 minutes of my life.
I hadn't changed my cuke yaml file since I started work on the app.
I tried:
* upgrading cucumber (FAIL)
* using another yaml file (FAIL)
* upgrading gherkin (FAIL)
* hard reseting the branch I was on (FAIL)
Turned out to just be a bum rerun.txt file. [...]]]></description>
			<content:encoded><![CDATA[<p>Yeah, I got that message today and wasted about 30 minutes of my life.</p>
<p>I hadn't changed my cuke yaml file since I started work on the app.</p>
<p>I tried:<br />
* upgrading cucumber (FAIL)<br />
* using another yaml file (FAIL)<br />
* upgrading gherkin (FAIL)<br />
* hard reseting the branch I was on (FAIL)</p>
<p>Turned out to just be a bum rerun.txt file. So I deleted it.</p>
<p>I need a refund on that 30 minutes.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=cucumber.yml+was+found%2C+but+could+not+be+parsed.+Please+refer+to+cucumber%E2%80%99s+documentation+on+correct+profile+usage.+http://coryodaniel.com/?p=623" title="Post to Twitter"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-twitter-big2.png" alt="Post to Twitter" /></a> <a class="tt" href="http://digg.com/submit?url=http://coryodaniel.com/index.php/2011/04/12/cucumber-yml-was-found-but-could-not-be-parsed-please-refer-to-cucumbers-documentation-on-correct-profile-usage/&amp;title=cucumber.yml+was+found%2C+but+could+not+be+parsed.+Please+refer+to+cucumber%E2%80%99s+documentation+on+correct+profile+usage." title="Post to Digg"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-digg-big2.png" alt="Post to Digg" /></a> <a class="tt" href="http://www.facebook.com/share.php?u=http://coryodaniel.com/index.php/2011/04/12/cucumber-yml-was-found-but-could-not-be-parsed-please-refer-to-cucumbers-documentation-on-correct-profile-usage/&amp;t=cucumber.yml+was+found%2C+but+could+not+be+parsed.+Please+refer+to+cucumber%E2%80%99s+documentation+on+correct+profile+usage." title="Post to Facebook"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-facebook-big2.png" alt="Post to Facebook" /></a> <a class="tt" href="http://reddit.com/submit?url=http://coryodaniel.com/index.php/2011/04/12/cucumber-yml-was-found-but-could-not-be-parsed-please-refer-to-cucumbers-documentation-on-correct-profile-usage/&amp;title=cucumber.yml+was+found%2C+but+could+not+be+parsed.+Please+refer+to+cucumber%E2%80%99s+documentation+on+correct+profile+usage." title="Post to Reddit"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-reddit-big2.png" alt="Post to Reddit" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://coryodaniel.com/index.php/2011/04/12/cucumber-yml-was-found-but-could-not-be-parsed-please-refer-to-cucumbers-documentation-on-correct-profile-usage/&amp;title=cucumber.yml+was+found%2C+but+could+not+be+parsed.+Please+refer+to+cucumber%E2%80%99s+documentation+on+correct+profile+usage." title="Post to StumbleUpon"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-su-big2.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://coryodaniel.com/index.php/2011/04/12/cucumber-yml-was-found-but-could-not-be-parsed-please-refer-to-cucumbers-documentation-on-correct-profile-usage/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to stop ruby&#8217;s builder gem from escaping too much stuff (like the links in your atom feeds) :(</title>
		<link>http://coryodaniel.com/index.php/2011/04/11/how-to-stop-rubys-builder-gem-from-escaping-too-much-stuff-like-the-links-in-your-atom-feeds/</link>
		<comments>http://coryodaniel.com/index.php/2011/04/11/how-to-stop-rubys-builder-gem-from-escaping-too-much-stuff-like-the-links-in-your-atom-feeds/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 01:15:51 +0000</pubDate>
		<dc:creator>Cory O'Daniel</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://coryodaniel.com/?p=621</guid>
		<description><![CDATA[So, I recently started working on Dealbase and its a rails 2 site. I don't have the luxury of called #html_safe on a string to stop it from being escaped.
While working on our syndication system I came across an interesting issue where the links in our Atom feeds were getting escaped:

1
2
3
4
5
6
7
&#60;!-- instead of --&#62;
&#60;link type=&#34;text/html&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>So, I recently started working on Dealbase and its a rails 2 site. I don't have the luxury of called #html_safe on a string to stop it from being escaped.</p>
<p>While working on our syndication system I came across an interesting issue where the links in our Atom feeds were getting escaped:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;!-- instead of --&gt;
&lt;link type=&quot;text/html&quot; rel=&quot;alternate&quot; href=&quot;http://dealbase.dev/Scottsdale-hotel-deals-discounts-457?deal=266679&amp;foo=bar&quot;/&gt;
&nbsp;
&lt;!-- I was getting --&gt;
&lt;link type=&quot;text/html&quot; rel=&quot;alternate&quot; href=&quot;http://dealbase.dev/Scottsdale-hotel-deals-discounts-457?deal=266679&amp;ampfoo=bar&quot;/&gt;
&nbsp;
&lt;!-- WOMP --&gt;</pre></td></tr></table></div>

<p>So I breakpointed and started poking around:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">atom_feed <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>feed<span style="color:#006600; font-weight:bold;">|</span>
  feed.<span style="color:#9900CC;">title</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;My cool feed&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  feed.<span style="color:#9900CC;">updated</span><span style="color:#006600; font-weight:bold;">&#40;</span>@items.<span style="color:#9900CC;">first</span>.<span style="color:#9900CC;">try</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:created_at</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">for</span> item <span style="color:#9966CC; font-weight:bold;">in</span> <span style="color:#0066ff; font-weight:bold;">@items</span>
    <span style="color:#008000; font-style:italic;"># here was the problem... cool_item_url(item) is getting escaped... right here though, its FINE?!</span>
    feed.<span style="color:#9900CC;">entry</span><span style="color:#006600; font-weight:bold;">&#40;</span>deal, <span style="color:#ff3333; font-weight:bold;">:url</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> cool_item_url<span style="color:#006600; font-weight:bold;">&#40;</span>item<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>entry<span style="color:#006600; font-weight:bold;">|</span>
      <span style="color:#008000; font-style:italic;">#... yada, yada</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Ok, so something is being called on it... right?<br />
I inspect the methods on the string that gets returned from cool_item_url(item) and found an interesting one called "to_xs".</p>
<p>So I throw an instance_eval in there to see whats up with this method:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">atom_feed <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>feed<span style="color:#006600; font-weight:bold;">|</span>
  feed.<span style="color:#9900CC;">title</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;My cool feed&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  feed.<span style="color:#9900CC;">updated</span><span style="color:#006600; font-weight:bold;">&#40;</span>@items.<span style="color:#9900CC;">first</span>.<span style="color:#9900CC;">try</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:created_at</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  link_hack = cool_item_url<span style="color:#006600; font-weight:bold;">&#40;</span>item<span style="color:#006600; font-weight:bold;">&#41;</span>
  link_hack.<span style="color:#9900CC;">instance_eval</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    <span style="color:#9966CC; font-weight:bold;">def</span> to_xs
      <span style="color:#CC0066; font-weight:bold;">raise</span> <span style="color:#CC00FF; font-weight:bold;">Exception</span>, <span style="color:#996600;">&quot;STOP CALLING THIS&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">for</span> item <span style="color:#9966CC; font-weight:bold;">in</span> <span style="color:#0066ff; font-weight:bold;">@items</span>
    feed.<span style="color:#9900CC;">entry</span><span style="color:#006600; font-weight:bold;">&#40;</span>deal, <span style="color:#ff3333; font-weight:bold;">:url</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> link_hack<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>entry<span style="color:#006600; font-weight:bold;">|</span>
      <span style="color:#008000; font-style:italic;">#... yada, yada</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Hit the atom feed, and boom. Exception. Yep, somethings calling it. I looked at the backtrace and its builder. After poking around I found this from the <a href="http://builder.rubyforge.org/">builder</a> docs:<br />
"String attribute values are now escaped by default by Builder (NOTE: this is new behavior as of version 2.0).<br />
However, occasionally you need to use entities in attribute values. Using a symbols (rather than a string) for an attribute value will cause Builder to not run its quoting/escaping algorithm on that particular value."</p>
<p>So the fix?</p>
<p>To call to_sym on the link in the builder.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">atom_feed <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>feed<span style="color:#006600; font-weight:bold;">|</span>
  feed.<span style="color:#9900CC;">title</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;My cool feed&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  feed.<span style="color:#9900CC;">updated</span><span style="color:#006600; font-weight:bold;">&#40;</span>@items.<span style="color:#9900CC;">first</span>.<span style="color:#9900CC;">try</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:created_at</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">for</span> item <span style="color:#9966CC; font-weight:bold;">in</span> <span style="color:#0066ff; font-weight:bold;">@items</span>
    feed.<span style="color:#9900CC;">entry</span><span style="color:#006600; font-weight:bold;">&#40;</span>deal, <span style="color:#ff3333; font-weight:bold;">:url</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> cool_item_url<span style="color:#006600; font-weight:bold;">&#40;</span>item<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">to_sym</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>entry<span style="color:#006600; font-weight:bold;">|</span>
      <span style="color:#008000; font-style:italic;">#... yada, yada</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Its ugly, but it works. Thanks builder :/</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=How+to+stop+ruby%E2%80%99s+builder+gem+from+escaping+too+much+stuff+%28like+the+links+in+your+atom+feeds%29+%3A%28+http://coryodaniel.com/?p=621" title="Post to Twitter"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-twitter-big2.png" alt="Post to Twitter" /></a> <a class="tt" href="http://digg.com/submit?url=http://coryodaniel.com/index.php/2011/04/11/how-to-stop-rubys-builder-gem-from-escaping-too-much-stuff-like-the-links-in-your-atom-feeds/&amp;title=How+to+stop+ruby%E2%80%99s+builder+gem+from+escaping+too+much+stuff+%28like+the+links+in+your+atom+feeds%29+%3A%28" title="Post to Digg"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-digg-big2.png" alt="Post to Digg" /></a> <a class="tt" href="http://www.facebook.com/share.php?u=http://coryodaniel.com/index.php/2011/04/11/how-to-stop-rubys-builder-gem-from-escaping-too-much-stuff-like-the-links-in-your-atom-feeds/&amp;t=How+to+stop+ruby%E2%80%99s+builder+gem+from+escaping+too+much+stuff+%28like+the+links+in+your+atom+feeds%29+%3A%28" title="Post to Facebook"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-facebook-big2.png" alt="Post to Facebook" /></a> <a class="tt" href="http://reddit.com/submit?url=http://coryodaniel.com/index.php/2011/04/11/how-to-stop-rubys-builder-gem-from-escaping-too-much-stuff-like-the-links-in-your-atom-feeds/&amp;title=How+to+stop+ruby%E2%80%99s+builder+gem+from+escaping+too+much+stuff+%28like+the+links+in+your+atom+feeds%29+%3A%28" title="Post to Reddit"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-reddit-big2.png" alt="Post to Reddit" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://coryodaniel.com/index.php/2011/04/11/how-to-stop-rubys-builder-gem-from-escaping-too-much-stuff-like-the-links-in-your-atom-feeds/&amp;title=How+to+stop+ruby%E2%80%99s+builder+gem+from+escaping+too+much+stuff+%28like+the+links+in+your+atom+feeds%29+%3A%28" title="Post to StumbleUpon"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-su-big2.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://coryodaniel.com/index.php/2011/04/11/how-to-stop-rubys-builder-gem-from-escaping-too-much-stuff-like-the-links-in-your-atom-feeds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backdateable mongoid models &#8211; a simple little module I use a lot</title>
		<link>http://coryodaniel.com/index.php/2011/03/24/backdateable-mongoid-models-a-simple-little-module-i-use-a-lot/</link>
		<comments>http://coryodaniel.com/index.php/2011/03/24/backdateable-mongoid-models-a-simple-little-module-i-use-a-lot/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 16:50:21 +0000</pubDate>
		<dc:creator>Cory O'Daniel</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[dates]]></category>
		<category><![CDATA[mongoid]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://coryodaniel.com/?p=607</guid>
		<description><![CDATA[I have a lot of models in one of the projects I am currently working on that need to be backdate-able. This is just a simple module I add to any class that needs to support it. It could be easily tweaked for ActiveRecord.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module Backdateable
  module ClassMethods;end;
&#160;
  def self.included&#40;base&#41;
    base.extend&#40;ClassMethods&#41;
 [...]]]></description>
			<content:encoded><![CDATA[<p>I have a lot of models in one of the projects I am currently working on that need to be backdate-able. This is just a simple module I add to any class that needs to support it. It could be easily tweaked for ActiveRecord.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">module</span> Backdateable
  <span style="color:#9966CC; font-weight:bold;">module</span> ClassMethods;end;
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">included</span><span style="color:#006600; font-weight:bold;">&#40;</span>base<span style="color:#006600; font-weight:bold;">&#41;</span>
    base.<span style="color:#9900CC;">extend</span><span style="color:#006600; font-weight:bold;">&#40;</span>ClassMethods<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#008000; font-style:italic;">#allows this to be an accessor on the front end, although, </span>
    <span style="color:#008000; font-style:italic;"># if the date is left blank, it gets set properly in before</span>
    base.<span style="color:#9900CC;">send</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:field</span>, <span style="color:#ff3333; font-weight:bold;">:backdated</span>, type: Boolean, default: <span style="color:#0000FF; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    base.<span style="color:#9900CC;">send</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:field</span>, <span style="color:#ff3333; font-weight:bold;">:recorded_at</span>, type: <span style="color:#CC00FF; font-weight:bold;">Time</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">if</span> base.<span style="color:#9900CC;">respond_to</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:default_scope</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      base.<span style="color:#9900CC;">send</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:default_scope</span>, <span style="color:#ff3333; font-weight:bold;">:asc</span>, <span style="color:#ff3333; font-weight:bold;">:recorded_at</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#008000; font-style:italic;"># Changing this to before_create only allows backdating on creation...</span>
    base.<span style="color:#9900CC;">send</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:before_save</span>, <span style="color:#ff3333; font-weight:bold;">:set_recorded_at</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># defaulting recorded at to created_at lets this be sortable by recorded at</span>
  <span style="color:#008000; font-style:italic;"># we override backdated here in case the date was originally left blank</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> set_recorded_at
    <span style="color:#0000FF; font-weight:bold;">self</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:recorded_at</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">||</span>= <span style="color:#0000FF; font-weight:bold;">self</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:created_at</span><span style="color:#006600; font-weight:bold;">&#93;</span>
    <span style="color:#0000FF; font-weight:bold;">self</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:backdated</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:recorded_at</span><span style="color:#006600; font-weight:bold;">&#93;</span> != <span style="color:#0000FF; font-weight:bold;">self</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:created_at</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0000FF; font-weight:bold;">true</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Now you can do:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Measurement
  <span style="color:#9966CC; font-weight:bold;">include</span> <span style="color:#6666ff; font-weight:bold;">Mongoid::Document</span>
  <span style="color:#9966CC; font-weight:bold;">include</span> <span style="color:#6666ff; font-weight:bold;">Mongoid::Timestamps</span>
  <span style="color:#9966CC; font-weight:bold;">include</span> Backdateable
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
Measurement.<span style="color:#9900CC;">create</span>
<span style="color:#008000; font-style:italic;"># =&gt; created_at &amp; recorded_at are set to the same, backdated is set to false</span>
&nbsp;
Measurement.<span style="color:#9900CC;">create</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:recorded_at</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">now</span>.<span style="color:#9900CC;">advance</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:days</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">7</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#008000; font-style:italic;"># =&gt; recorded_at is set to the past, backdated is set to true</span></pre></td></tr></table></div>

<p>Why do I default recorded at to created at? So I can sort by recorded_at.</p>
<p>Done, son.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Backdateable+mongoid+models+%E2%80%93+a+simple+little+module+I+use+a+lot+http://coryodaniel.com/?p=607" title="Post to Twitter"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-twitter-big2.png" alt="Post to Twitter" /></a> <a class="tt" href="http://digg.com/submit?url=http://coryodaniel.com/index.php/2011/03/24/backdateable-mongoid-models-a-simple-little-module-i-use-a-lot/&amp;title=Backdateable+mongoid+models+%E2%80%93+a+simple+little+module+I+use+a+lot" title="Post to Digg"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-digg-big2.png" alt="Post to Digg" /></a> <a class="tt" href="http://www.facebook.com/share.php?u=http://coryodaniel.com/index.php/2011/03/24/backdateable-mongoid-models-a-simple-little-module-i-use-a-lot/&amp;t=Backdateable+mongoid+models+%E2%80%93+a+simple+little+module+I+use+a+lot" title="Post to Facebook"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-facebook-big2.png" alt="Post to Facebook" /></a> <a class="tt" href="http://reddit.com/submit?url=http://coryodaniel.com/index.php/2011/03/24/backdateable-mongoid-models-a-simple-little-module-i-use-a-lot/&amp;title=Backdateable+mongoid+models+%E2%80%93+a+simple+little+module+I+use+a+lot" title="Post to Reddit"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-reddit-big2.png" alt="Post to Reddit" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://coryodaniel.com/index.php/2011/03/24/backdateable-mongoid-models-a-simple-little-module-i-use-a-lot/&amp;title=Backdateable+mongoid+models+%E2%80%93+a+simple+little+module+I+use+a+lot" title="Post to StumbleUpon"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-su-big2.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://coryodaniel.com/index.php/2011/03/24/backdateable-mongoid-models-a-simple-little-module-i-use-a-lot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Biting myself on the ass with Cucumber</title>
		<link>http://coryodaniel.com/index.php/2011/03/23/biting-myself-on-the-ass-with-cucumber/</link>
		<comments>http://coryodaniel.com/index.php/2011/03/23/biting-myself-on-the-ass-with-cucumber/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 03:30:17 +0000</pubDate>
		<dc:creator>Cory O'Daniel</dc:creator>
				<category><![CDATA[BDD]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[RubyDevelopment]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://coryodaniel.com/?p=605</guid>
		<description><![CDATA[So I spent a few hours today biting my own ass with cucumber.
If you are ever trying to "see" stuff in your page and notice that it has strangely disappeared, like oh say, your flash messages or validation errors. You may want to pay close attention if you are testing the page you are on [...]]]></description>
			<content:encoded><![CDATA[<p>So I spent a few hours today biting my own ass with cucumber.</p>
<p>If you are ever trying to "see" stuff in your page and notice that it has strangely disappeared, like oh say, your flash messages or validation errors. You may want to pay close attention if you are testing the page you are on just before hand.</p>
<p>I found out a sore lesson today, there is a big difference between:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="plain" style="font-family:monospace;">Then I am on the sign up page
And I should see &quot;Email can't be blank&quot;</pre></td></tr></table></div>

<p>And</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="plain" style="font-family:monospace;">Then I should be on the sign up page
And I should see &quot;Email can't be blank&quot;</pre></td></tr></table></div>

<p>The difference here? "The I am on" reloads the page. I didn't know that. So I was <i>trying</i> to make sure I was on the right page, then checking for errors, etc. The page would reload, all my errors would be gone, and my feature was failing.</p>
<p>"Then I should be on" tests that the url matches the one you are on.</p>
<p>The more you know.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Biting+myself+on+the+ass+with+Cucumber+http://coryodaniel.com/?p=605" title="Post to Twitter"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-twitter-big2.png" alt="Post to Twitter" /></a> <a class="tt" href="http://digg.com/submit?url=http://coryodaniel.com/index.php/2011/03/23/biting-myself-on-the-ass-with-cucumber/&amp;title=Biting+myself+on+the+ass+with+Cucumber" title="Post to Digg"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-digg-big2.png" alt="Post to Digg" /></a> <a class="tt" href="http://www.facebook.com/share.php?u=http://coryodaniel.com/index.php/2011/03/23/biting-myself-on-the-ass-with-cucumber/&amp;t=Biting+myself+on+the+ass+with+Cucumber" title="Post to Facebook"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-facebook-big2.png" alt="Post to Facebook" /></a> <a class="tt" href="http://reddit.com/submit?url=http://coryodaniel.com/index.php/2011/03/23/biting-myself-on-the-ass-with-cucumber/&amp;title=Biting+myself+on+the+ass+with+Cucumber" title="Post to Reddit"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-reddit-big2.png" alt="Post to Reddit" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://coryodaniel.com/index.php/2011/03/23/biting-myself-on-the-ass-with-cucumber/&amp;title=Biting+myself+on+the+ass+with+Cucumber" title="Post to StumbleUpon"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-su-big2.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://coryodaniel.com/index.php/2011/03/23/biting-myself-on-the-ass-with-cucumber/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Matching Unicode characters and strings with Regexp in Ruby 1.9.2</title>
		<link>http://coryodaniel.com/index.php/2011/02/22/matching-unicode-characters-and-strings-with-regexp-in-ruby-1-9-2/</link>
		<comments>http://coryodaniel.com/index.php/2011/02/22/matching-unicode-characters-and-strings-with-regexp-in-ruby-1-9-2/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 22:13:38 +0000</pubDate>
		<dc:creator>Cory O'Daniel</dc:creator>
				<category><![CDATA[RubyDevelopment]]></category>
		<category><![CDATA[matching]]></category>
		<category><![CDATA[regexp]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby1.9]]></category>
		<category><![CDATA[unicode]]></category>

		<guid isPermaLink="false">http://coryodaniel.com/?p=592</guid>
		<description><![CDATA[So I've been working on a revamp of a project (still secret, ohhhh ahhh) and I needed Unicode support for multiple languages. I whipped up a pretty simple regexp and found that it didn't work for my test case.
So I've got something equivalent to this running inside some rails rspec test. And my test is [...]]]></description>
			<content:encoded><![CDATA[<p>So I've been working on a revamp of a project (still secret, ohhhh ahhh) and I needed Unicode support for multiple languages. I whipped up a pretty simple regexp and found that it didn't work for my test case.</p>
<p>So I've got something equivalent to this running inside some rails rspec test. And my test is failing because I'm expecting some russian words.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">greeting  = <span style="color:#996600;">&quot;Добрый день.&quot;</span>
greeting.<span style="color:#9900CC;">scan</span><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#006600; font-weight:bold;">/</span>\w<span style="color:#006600; font-weight:bold;">/</span>u <span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#008000; font-style:italic;">#=&gt; []</span></pre></td></tr></table></div>

<p>WTF.</p>
<p>I double check:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">greeting  = <span style="color:#996600;">&quot;Добрый день.&quot;</span>
pattern = <span style="color:#006600; font-weight:bold;">/</span>\w<span style="color:#006600; font-weight:bold;">/</span>u
&nbsp;
<span style="color:#CC0066; font-weight:bold;">puts</span> greeting.<span style="color:#9900CC;">encoding</span>
<span style="color:#008000; font-style:italic;"># =&gt; UTF-8</span>
&nbsp;
<span style="color:#CC0066; font-weight:bold;">puts</span> pattern.<span style="color:#9900CC;">encoding</span>
<span style="color:#008000; font-style:italic;"># =&gt; UTF-8</span></pre></td></tr></table></div>

<p>Hell, I even have "# encoding: UTF-8" at the top of the file.<br />
Fuuuuuuuuuuuuuuuuuuuuuuu.</p>
<p>After some google and some irc'ing I find <a href="http://www.ruby-forum.com/topic/210770">this answer</a>, which solves the problem and allows for matches of unicode characters in ruby 1.9.2, but I still can't figure out what the 'p' stands for. I'm guessing "please". The problem is apparently there was an issue with \w matching unicode characters, so \w specifically only works with ASCII.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">greeting  = <span style="color:#996600;">&quot;Добрый день.&quot;</span>
greeting.<span style="color:#9900CC;">scan</span><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#006600; font-weight:bold;">/</span>\<span style="color:#CC0066; font-weight:bold;">p</span><span style="color:#006600; font-weight:bold;">&#123;</span>Word<span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">/</span>u <span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#008000; font-style:italic;">#=&gt; [&quot;Добрый&quot;, &quot;день&quot;]</span></pre></td></tr></table></div>

<p>Wööt.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Matching+Unicode+characters+and+strings+with+Regexp+in+Ruby+1.9.2+http://coryodaniel.com/?p=592" title="Post to Twitter"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-twitter-big2.png" alt="Post to Twitter" /></a> <a class="tt" href="http://digg.com/submit?url=http://coryodaniel.com/index.php/2011/02/22/matching-unicode-characters-and-strings-with-regexp-in-ruby-1-9-2/&amp;title=Matching+Unicode+characters+and+strings+with+Regexp+in+Ruby+1.9.2" title="Post to Digg"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-digg-big2.png" alt="Post to Digg" /></a> <a class="tt" href="http://www.facebook.com/share.php?u=http://coryodaniel.com/index.php/2011/02/22/matching-unicode-characters-and-strings-with-regexp-in-ruby-1-9-2/&amp;t=Matching+Unicode+characters+and+strings+with+Regexp+in+Ruby+1.9.2" title="Post to Facebook"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-facebook-big2.png" alt="Post to Facebook" /></a> <a class="tt" href="http://reddit.com/submit?url=http://coryodaniel.com/index.php/2011/02/22/matching-unicode-characters-and-strings-with-regexp-in-ruby-1-9-2/&amp;title=Matching+Unicode+characters+and+strings+with+Regexp+in+Ruby+1.9.2" title="Post to Reddit"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-reddit-big2.png" alt="Post to Reddit" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://coryodaniel.com/index.php/2011/02/22/matching-unicode-characters-and-strings-with-regexp-in-ruby-1-9-2/&amp;title=Matching+Unicode+characters+and+strings+with+Regexp+in+Ruby+1.9.2" title="Post to StumbleUpon"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-su-big2.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://coryodaniel.com/index.php/2011/02/22/matching-unicode-characters-and-strings-with-regexp-in-ruby-1-9-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HamlburgerHelper sets the Table &#8211; Easily create and display standard tables in Rails</title>
		<link>http://coryodaniel.com/index.php/2011/02/16/hamlburgerhelper-sets-the-table-easily-create-and-display-standard-tables-in-rails/</link>
		<comments>http://coryodaniel.com/index.php/2011/02/16/hamlburgerhelper-sets-the-table-easily-create-and-display-standard-tables-in-rails/#comments</comments>
		<pubDate>Thu, 17 Feb 2011 02:04:02 +0000</pubDate>
		<dc:creator>Cory O'Daniel</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[RubyDevelopment]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[haml]]></category>
		<category><![CDATA[helpers]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[tables]]></category>

		<guid isPermaLink="false">http://coryodaniel.com/?p=580</guid>
		<description><![CDATA[I create tables a lot in my back end for display information. 
I posted a table display/create helper method on dzone that easy to use but has a ton of options.
This is the helper I currently use on my admin backend pages to create the simplest table to a pretty complex table.
Here are all of [...]]]></description>
			<content:encoded><![CDATA[<p>I create tables a lot in my back end for display information. </p>
<p>I posted a <a href="http://snippets.dzone.com/posts/show/12951">table display/create helper method</a> on dzone that easy to use but has a ton of options.</p>
<p>This is the helper I currently use on my admin backend pages to create the simplest table to a pretty complex table.</p>
<p>Here are all of the available options and their defaults:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">      <span style="color:#ff3333; font-weight:bold;">:table_class</span>        <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'display_grid'</span>, <span style="color:#008000; font-style:italic;"># CSS class name of the table</span>
      <span style="color:#ff3333; font-weight:bold;">:table_id</span>           <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;display_grid_#{objects.first.class.to_s.underscore.pluralize}&quot;</span>, <span style="color:#008000; font-style:italic;"># CSS ID of the table</span>
      <span style="color:#ff3333; font-weight:bold;">:heading_class</span>      <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'display_grid_heading'</span>, <span style="color:#008000; font-style:italic;"># CSS class name of the first TR (one containing TH)</span>
      <span style="color:#ff3333; font-weight:bold;">:heading_id</span>         <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;display_grid_heading_#{objects.first.class.to_s.underscore.pluralize}&quot;</span>, <span style="color:#008000; font-style:italic;"># CSS ID of the first TR</span>
      <span style="color:#ff3333; font-weight:bold;">:th_class</span>           <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'display_grid_th'</span>, <span style="color:#008000; font-style:italic;"># CSS class for all TH elements</span>
      <span style="color:#ff3333; font-weight:bold;">:tr_class</span>           <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'display_grid_tr'</span>, <span style="color:#008000; font-style:italic;"># CSS class for all TR elements</span>
      <span style="color:#ff3333; font-weight:bold;">:td_class</span>           <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'display_grid_td'</span>,  <span style="color:#008000; font-style:italic;"># CSS class for all TD elements</span>
      <span style="color:#ff3333; font-weight:bold;">:even_odd</span>           <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>, <span style="color:#008000; font-style:italic;"># Should even/odd classes be added</span>
      <span style="color:#ff3333; font-weight:bold;">:format_date</span>        <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">nil</span>, <span style="color:#008000; font-style:italic;">#nil | lambda{|datetime|} # Time formatter (receives date object, expects string)</span>
      <span style="color:#ff3333; font-weight:bold;">:numeric_td_class</span>   <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'numeric'</span>, <span style="color:#008000; font-style:italic;"># CSS class for any TDs containing a number</span>
      <span style="color:#ff3333; font-weight:bold;">:date_td_class</span>      <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'date'</span>, <span style="color:#008000; font-style:italic;"># CSS class for any TDs containing something date-like</span>
      <span style="color:#ff3333; font-weight:bold;">:string_td_class</span>    <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'string'</span>, <span style="color:#008000; font-style:italic;"># CSS class for any TDs containing a string</span>
&nbsp;
      <span style="color:#008000; font-style:italic;"># Any of this will create an 'Actions' heading, the lambdas receive the object, and expect a string</span>
      <span style="color:#ff3333; font-weight:bold;">:show_action</span>        <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">nil</span>, <span style="color:#008000; font-style:italic;"># lambda{|object| link_to '', my_path(object)}</span>
      <span style="color:#ff3333; font-weight:bold;">:edit_action</span>        <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">nil</span>, <span style="color:#008000; font-style:italic;"># lambda{|object|} </span>
      <span style="color:#ff3333; font-weight:bold;">:destroy_action</span>     <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">nil</span>, <span style="color:#008000; font-style:italic;"># lambda{|object|}</span></pre></td></tr></table></div>

<p>Using it is pretty easy, just drop it in your app/helpers folder and...</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">display_grid<span style="color:#006600; font-weight:bold;">&#40;</span>User.<span style="color:#9900CC;">all</span>, <span style="color:#006600; font-weight:bold;">&#123;</span>
  <span style="color:#ff3333; font-weight:bold;">:show_action</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#CC0066; font-weight:bold;">lambda</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>user<span style="color:#006600; font-weight:bold;">|</span> link_to user.<span style="color:#9900CC;">display_name</span>, public_user_path<span style="color:#006600; font-weight:bold;">&#40;</span>user<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#ff3333; font-weight:bold;">:table_id</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'cool_users'</span>
<span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div>

<p>Its pretty simple. It'll dump out a table, and then you can go and style it using the CSS classes/ids above.</p>
<p>Woot, back end DRY.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=HamlburgerHelper+sets+the+Table+%E2%80%93+Easily+create+and+display+standard+tables+in+Rails+http://coryodaniel.com/?p=580" title="Post to Twitter"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-twitter-big2.png" alt="Post to Twitter" /></a> <a class="tt" href="http://digg.com/submit?url=http://coryodaniel.com/index.php/2011/02/16/hamlburgerhelper-sets-the-table-easily-create-and-display-standard-tables-in-rails/&amp;title=HamlburgerHelper+sets+the+Table+%E2%80%93+Easily+create+and+display+standard+tables+in+Rails" title="Post to Digg"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-digg-big2.png" alt="Post to Digg" /></a> <a class="tt" href="http://www.facebook.com/share.php?u=http://coryodaniel.com/index.php/2011/02/16/hamlburgerhelper-sets-the-table-easily-create-and-display-standard-tables-in-rails/&amp;t=HamlburgerHelper+sets+the+Table+%E2%80%93+Easily+create+and+display+standard+tables+in+Rails" title="Post to Facebook"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-facebook-big2.png" alt="Post to Facebook" /></a> <a class="tt" href="http://reddit.com/submit?url=http://coryodaniel.com/index.php/2011/02/16/hamlburgerhelper-sets-the-table-easily-create-and-display-standard-tables-in-rails/&amp;title=HamlburgerHelper+sets+the+Table+%E2%80%93+Easily+create+and+display+standard+tables+in+Rails" title="Post to Reddit"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-reddit-big2.png" alt="Post to Reddit" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://coryodaniel.com/index.php/2011/02/16/hamlburgerhelper-sets-the-table-easily-create-and-display-standard-tables-in-rails/&amp;title=HamlburgerHelper+sets+the+Table+%E2%80%93+Easily+create+and+display+standard+tables+in+Rails" title="Post to StumbleUpon"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-su-big2.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://coryodaniel.com/index.php/2011/02/16/hamlburgerhelper-sets-the-table-easily-create-and-display-standard-tables-in-rails/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

