<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Rails on Bridge</title><link>https://quarternotecoda.com/tags/rails/</link><description>Recent content in Rails on Bridge</description><generator>Hugo -- 0.160.1</generator><language>en-us</language><lastBuildDate>Fri, 20 Jul 2012 00:00:00 +0000</lastBuildDate><atom:link href="https://quarternotecoda.com/tags/rails/index.xml" rel="self" type="application/rss+xml"/><item><title>Running Rails 3.2 on a shared Dreamhost with Passenger</title><link>https://quarternotecoda.com/posts/2012-07-20-running-rails-3-dot-2-on-a-shared-dreamhost-with-passenger/</link><pubDate>Fri, 20 Jul 2012 00:00:00 +0000</pubDate><guid>https://quarternotecoda.com/posts/2012-07-20-running-rails-3-dot-2-on-a-shared-dreamhost-with-passenger/</guid><description>&lt;p&gt;&lt;em&gt;Update:&lt;/em&gt; While it&amp;rsquo;s good to understand what you&amp;rsquo;re doing, &lt;a href="https://gist.github.com/4658117"&gt;this template file&lt;/a&gt; will get you so that after you get your app running, &lt;code&gt;cap deploy:setup&lt;/code&gt; and &lt;code&gt;cap deploy:cold&lt;/code&gt; works, assuming you have the host set up properly and have your app&amp;rsquo;s main directory cleared of all files.&lt;/p&gt;
&lt;h2 id="everybody-loves-dreamhost-but"&gt;Everybody Loves Dreamhost, but&amp;hellip;&lt;/h2&gt;
&lt;p&gt;Dreamhost is a great little hosting company, but it really lags when it comes to keeping the latest software up to date. It&amp;rsquo;s version of Ruby is 1.8.7 and the latest stable version of Rails they have running is 3.0.3. That release is technically in &amp;ldquo;security fix&amp;rdquo; mode. Ugh.&lt;/p&gt;</description></item><item><title>ImageMagick, JPEGs, and Orientation, Oh My</title><link>https://quarternotecoda.com/posts/2012-06-13-imagemagick/</link><pubDate>Wed, 13 Jun 2012 00:00:00 +0000</pubDate><guid>https://quarternotecoda.com/posts/2012-06-13-imagemagick/</guid><description>&lt;p&gt;I&amp;rsquo;ve been working on a new project and decided to use CarrierWave to handle image uploads (and minor automatic manipulation). Everything looked great, but then my new boss, who has a penchant for finding the one or two things wrong with your latest well-tested feature uploaded a JPEG that looked fine in Preview, but automatically rotated on upload.&lt;/p&gt;
&lt;p&gt;After checking through the directory, it seemed that only the processed images were getting rotated. Actually, &amp;lsquo;rotated&amp;rsquo; is a misnomer, they were actually just losing their orientation. JPEGs have EXIF meta data that can contain the orientation of a picture, no matter how it&amp;rsquo;s stored. This allows cameras to store everything as a 640x480, but display some in the reverse (480x640). The only thing different when the camera writes the image is what orientation the gyroscope adds to the meta data.&lt;/p&gt;</description></item><item><title>DCI Generators in Rails</title><link>https://quarternotecoda.com/posts/2012-05-22-dci-generators-in-rails/</link><pubDate>Tue, 22 May 2012 00:00:00 +0000</pubDate><guid>https://quarternotecoda.com/posts/2012-05-22-dci-generators-in-rails/</guid><description>&lt;p&gt;Recently, in my new project, I decided to take the &lt;a href="http://en.wikipedia.org/wiki/Data,_context_and_interaction"&gt;DCI&lt;/a&gt; approach that &lt;a href="http://mikepackdev.com/blog_posts/24-the-right-way-to-code-dci-in-ruby"&gt;Mike Pack outlined&lt;/a&gt;, which has been really cool. I&amp;rsquo;ve been able to keep my tests fast, and have very distinct buckets to put data (models), specific roles of that data (rather than cluttering up the models), and an easy way to take a use case and map it out programatically (contexts).&lt;/p&gt;
&lt;p&gt;I noticed that I was generating roles and contexts regularly and copying from previously written code examples so I decided to make role and context generators. The process wasn&amp;rsquo;t bad, but it did take a couple of steps that took a little digging to understand.&lt;/p&gt;</description></item><item><title>CanCan and Devise with nil current_user on POST</title><link>https://quarternotecoda.com/posts/2012-04-11-cancan-and-devise-with-nil-current-user-on-post/</link><pubDate>Wed, 11 Apr 2012 00:00:00 +0000</pubDate><guid>https://quarternotecoda.com/posts/2012-04-11-cancan-and-devise-with-nil-current-user-on-post/</guid><description>&lt;p&gt;I had a Rails 2.3.X app that I migrated to Rails 3. When I did, I upgraded CanCan and Devise. Suddenly, my delete links weren&amp;rsquo;t working. I remembered that unobtrusive JS was the default so I hopped into the &lt;code&gt;application.html.erb&lt;/code&gt; template and added the relevant javascript tags.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-ruby" data-lang="ruby"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#666"&gt;...&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#666"&gt;&amp;lt;&lt;/span&gt;head&lt;span style="color:#666"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#666"&gt;...&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#666"&gt;&amp;lt;%=&lt;/span&gt; javascript_include_tag &lt;span style="color:#4070a0"&gt;&amp;#39;prototype&amp;#39;&lt;/span&gt;, &lt;span style="color:#4070a0"&gt;&amp;#39;rails&amp;#39;&lt;/span&gt;, &lt;span style="color:#4070a0"&gt;&amp;#39;application&amp;#39;&lt;/span&gt; &lt;span style="color:#4070a0"&gt;%&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#4070a0"&gt; ...
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#4070a0"&gt; &amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#666"&gt;...&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Great! Now my delete links weren&amp;rsquo;t just links to the show action, but when I did click them I noticed that a CanCan error appeared. After some debug statements, it became clear that &lt;code&gt;current_user&lt;/code&gt; wasn&amp;rsquo;t set, but only on the POST/DELETE methods. Hmmm. What could be causing this?&lt;/p&gt;</description></item><item><title>Don't Use DateTime in Rails 3</title><link>https://quarternotecoda.com/posts/2011-11-29-dont-use-datetime-in-rails-3/</link><pubDate>Tue, 29 Nov 2011 00:00:00 +0000</pubDate><guid>https://quarternotecoda.com/posts/2011-11-29-dont-use-datetime-in-rails-3/</guid><description>&lt;p&gt;Rails 3 has good TimeZone support built in, but you have to use the right Date and Time classes to get full support.&lt;/p&gt;
&lt;p&gt;If you have this set in your application.rb &lt;code&gt;config.active_record.default_timezone = :local&lt;/code&gt;, then you really need to use Time so that it properly identifies itself as being in the local timezone and not in UTC when passing to the database insert.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-ruby" data-lang="ruby"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ree&lt;span style="color:#666"&gt;-&lt;/span&gt;&lt;span style="color:#40a070"&gt;1&lt;/span&gt;&lt;span style="color:#666"&gt;.&lt;/span&gt;&lt;span style="color:#40a070"&gt;8&lt;/span&gt;&lt;span style="color:#666"&gt;.&lt;/span&gt;&lt;span style="color:#40a070"&gt;7&lt;/span&gt;&lt;span style="color:#666"&gt;-&lt;/span&gt;&lt;span style="color:#40a070"&gt;2011&lt;/span&gt;&lt;span style="color:#666"&gt;.&lt;/span&gt;&lt;span style="color:#40a070"&gt;03&lt;/span&gt; :&lt;span style="color:#40a070"&gt;001&lt;/span&gt; &lt;span style="color:#666"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color:#60add5"&gt;DateTime&lt;/span&gt;&lt;span style="color:#666"&gt;.&lt;/span&gt;parse(&lt;span style="color:#4070a0"&gt;&amp;#39;2011-11-27 12:00:00 +0000&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#666"&gt;=&amp;gt;&lt;/span&gt; &lt;span style="color:#60add5"&gt;Sun&lt;/span&gt;, &lt;span style="color:#40a070"&gt;27&lt;/span&gt; &lt;span style="color:#60add5"&gt;Nov&lt;/span&gt; &lt;span style="color:#40a070"&gt;2011&lt;/span&gt; &lt;span style="color:#40a070"&gt;12&lt;/span&gt;:&lt;span style="color:#40a070"&gt;00&lt;/span&gt;:&lt;span style="color:#40a070"&gt;00&lt;/span&gt; &lt;span style="color:#666"&gt;+&lt;/span&gt;&lt;span style="color:#40a070"&gt;0000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ree&lt;span style="color:#666"&gt;-&lt;/span&gt;&lt;span style="color:#40a070"&gt;1&lt;/span&gt;&lt;span style="color:#666"&gt;.&lt;/span&gt;&lt;span style="color:#40a070"&gt;8&lt;/span&gt;&lt;span style="color:#666"&gt;.&lt;/span&gt;&lt;span style="color:#40a070"&gt;7&lt;/span&gt;&lt;span style="color:#666"&gt;-&lt;/span&gt;&lt;span style="color:#40a070"&gt;2011&lt;/span&gt;&lt;span style="color:#666"&gt;.&lt;/span&gt;&lt;span style="color:#40a070"&gt;03&lt;/span&gt; :&lt;span style="color:#40a070"&gt;002&lt;/span&gt; &lt;span style="color:#666"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color:#60add5"&gt;DateTime&lt;/span&gt;&lt;span style="color:#666"&gt;.&lt;/span&gt;parse(&lt;span style="color:#4070a0"&gt;&amp;#39;2011-11-27 12:00:00&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#666"&gt;=&amp;gt;&lt;/span&gt; &lt;span style="color:#60add5"&gt;Sun&lt;/span&gt;, &lt;span style="color:#40a070"&gt;27&lt;/span&gt; &lt;span style="color:#60add5"&gt;Nov&lt;/span&gt; &lt;span style="color:#40a070"&gt;2011&lt;/span&gt; &lt;span style="color:#40a070"&gt;12&lt;/span&gt;:&lt;span style="color:#40a070"&gt;00&lt;/span&gt;:&lt;span style="color:#40a070"&gt;00&lt;/span&gt; &lt;span style="color:#666"&gt;+&lt;/span&gt;&lt;span style="color:#40a070"&gt;0000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ree&lt;span style="color:#666"&gt;-&lt;/span&gt;&lt;span style="color:#40a070"&gt;1&lt;/span&gt;&lt;span style="color:#666"&gt;.&lt;/span&gt;&lt;span style="color:#40a070"&gt;8&lt;/span&gt;&lt;span style="color:#666"&gt;.&lt;/span&gt;&lt;span style="color:#40a070"&gt;7&lt;/span&gt;&lt;span style="color:#666"&gt;-&lt;/span&gt;&lt;span style="color:#40a070"&gt;2011&lt;/span&gt;&lt;span style="color:#666"&gt;.&lt;/span&gt;&lt;span style="color:#40a070"&gt;03&lt;/span&gt; :&lt;span style="color:#40a070"&gt;003&lt;/span&gt; &lt;span style="color:#666"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color:#60add5"&gt;Time&lt;/span&gt;&lt;span style="color:#666"&gt;.&lt;/span&gt;parse(&lt;span style="color:#4070a0"&gt;&amp;#39;2011-11-27 12:00:00 +0000&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#666"&gt;=&amp;gt;&lt;/span&gt; &lt;span style="color:#60add5"&gt;Sun&lt;/span&gt; &lt;span style="color:#60add5"&gt;Nov&lt;/span&gt; &lt;span style="color:#40a070"&gt;27&lt;/span&gt; &lt;span style="color:#40a070"&gt;06&lt;/span&gt;:&lt;span style="color:#40a070"&gt;00&lt;/span&gt;:&lt;span style="color:#40a070"&gt;00&lt;/span&gt; &lt;span style="color:#666"&gt;-&lt;/span&gt;&lt;span style="color:#40a070"&gt;0600&lt;/span&gt; &lt;span style="color:#40a070"&gt;2011&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ree&lt;span style="color:#666"&gt;-&lt;/span&gt;&lt;span style="color:#40a070"&gt;1&lt;/span&gt;&lt;span style="color:#666"&gt;.&lt;/span&gt;&lt;span style="color:#40a070"&gt;8&lt;/span&gt;&lt;span style="color:#666"&gt;.&lt;/span&gt;&lt;span style="color:#40a070"&gt;7&lt;/span&gt;&lt;span style="color:#666"&gt;-&lt;/span&gt;&lt;span style="color:#40a070"&gt;2011&lt;/span&gt;&lt;span style="color:#666"&gt;.&lt;/span&gt;&lt;span style="color:#40a070"&gt;03&lt;/span&gt; :&lt;span style="color:#40a070"&gt;004&lt;/span&gt; &lt;span style="color:#666"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color:#60add5"&gt;Time&lt;/span&gt;&lt;span style="color:#666"&gt;.&lt;/span&gt;parse(&lt;span style="color:#4070a0"&gt;&amp;#39;2011-11-27 12:00:00&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#666"&gt;=&amp;gt;&lt;/span&gt; &lt;span style="color:#60add5"&gt;Sun&lt;/span&gt; &lt;span style="color:#60add5"&gt;Nov&lt;/span&gt; &lt;span style="color:#40a070"&gt;27&lt;/span&gt; &lt;span style="color:#40a070"&gt;12&lt;/span&gt;:&lt;span style="color:#40a070"&gt;00&lt;/span&gt;:&lt;span style="color:#40a070"&gt;00&lt;/span&gt; &lt;span style="color:#666"&gt;-&lt;/span&gt;&lt;span style="color:#40a070"&gt;0600&lt;/span&gt; &lt;span style="color:#40a070"&gt;2011&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;So basically, Time.parse always returns the value in the local timezone, DateTime.parse always returns the value in UTC. To get complete compatibility, always use Time.parse. Trust me, I learned the hard way :)&lt;/p&gt;</description></item><item><title>Migrating Serialized Columns in Rails</title><link>https://quarternotecoda.com/posts/2011-03-03-migrating-serialized-columns-in-rails/</link><pubDate>Thu, 03 Mar 2011 00:00:00 +0000</pubDate><guid>https://quarternotecoda.com/posts/2011-03-03-migrating-serialized-columns-in-rails/</guid><description>&lt;p&gt;I recently switched a serialized column in Rails from one type (Hash) to another (OpenStruct) and ran into a little problem when I tried to migrate, namely, that loading the model threw a SerializationTypeMismatch error. Hmm&amp;hellip; how am I going to get at the base YAML and translate all of these without being brittle?&lt;/p&gt;
&lt;p&gt;The answer is to copy the column, nullify it, and the load the raw YAML manually:&lt;/p&gt;</description></item><item><title>Optional Heirarchal Checkbox Selection with Nested Attributes in Rails</title><link>https://quarternotecoda.com/posts/2010-06-04-optional-heirarchal-checkbox-selection-with-nested-attributes-in-rails/</link><pubDate>Fri, 04 Jun 2010 00:00:00 +0000</pubDate><guid>https://quarternotecoda.com/posts/2010-06-04-optional-heirarchal-checkbox-selection-with-nested-attributes-in-rails/</guid><description>&lt;p&gt;I had a process where I wanted users to fill out a survey which had hierarchal categories AND be able to specify some additional data for specific capabilities that the user had.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://quarternotecoda.com/images/Screen-shot-2010-06-04-at-2.11.01-PM.png"&gt;&lt;img src="https://quarternotecoda.com/images/Screen-shot-2010-06-04-at-2.11.01-PM.png" alt="" title="Categories Example" width="260" height="276" class="alignnone size-full wp-image-73" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now, you could easily do this for a small subset and hand-code every item, but I wanted a flexible survey system that allowed true hierarchy and generalized code.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s start off with the basic survey and capabilities models and relationships:&lt;/p&gt;</description></item><item><title>Rails Controller Specs with users, roles and nested routes</title><link>https://quarternotecoda.com/posts/2010-03-03-rails-controller-specs-with-users-roles-and-nested-routes/</link><pubDate>Wed, 03 Mar 2010 00:00:00 +0000</pubDate><guid>https://quarternotecoda.com/posts/2010-03-03-rails-controller-specs-with-users-roles-and-nested-routes/</guid><description>&lt;p&gt;I&amp;rsquo;ve long put off testing my controllers because of user authentication and nested controllers, dealing with stubs, etc.&lt;/p&gt;
&lt;p&gt;But today, a fully working test!&lt;/p&gt;
&lt;p&gt;As background, Advertisers have many trackers and the routes look like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-ruby" data-lang="ruby"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#60add5"&gt;ActionController&lt;/span&gt;&lt;span style="color:#666"&gt;::&lt;/span&gt;&lt;span style="color:#60add5"&gt;Routing&lt;/span&gt;&lt;span style="color:#666"&gt;::&lt;/span&gt;&lt;span style="color:#60add5"&gt;Routes&lt;/span&gt;&lt;span style="color:#666"&gt;.&lt;/span&gt;draw &lt;span style="color:#007020;font-weight:bold"&gt;do&lt;/span&gt; &lt;span style="color:#666"&gt;|&lt;/span&gt;map&lt;span style="color:#666"&gt;|&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; map&lt;span style="color:#666"&gt;.&lt;/span&gt;resources &lt;span style="color:#517918"&gt;:advertisers&lt;/span&gt; &lt;span style="color:#007020;font-weight:bold"&gt;do&lt;/span&gt; &lt;span style="color:#666"&gt;|&lt;/span&gt;advertisers&lt;span style="color:#666"&gt;|&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; advertisers&lt;span style="color:#666"&gt;.&lt;/span&gt;resources &lt;span style="color:#517918"&gt;:trackers&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#007020;font-weight:bold"&gt;end&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#007020;font-weight:bold"&gt;end&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To set everything up in the specs, I included all the files in the spec/support directory and used &lt;a href="http://mocha.rubyforge.org/"&gt;Mocha&lt;/a&gt; as my mock framework&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-ruby" data-lang="ruby"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#60add5"&gt;Dir&lt;/span&gt;&lt;span style="color:#666"&gt;[&lt;/span&gt;&lt;span style="color:#60add5"&gt;File&lt;/span&gt;&lt;span style="color:#666"&gt;.&lt;/span&gt;expand_path(&lt;span style="color:#60add5"&gt;File&lt;/span&gt;&lt;span style="color:#666"&gt;.&lt;/span&gt;join(&lt;span style="color:#60add5"&gt;File&lt;/span&gt;&lt;span style="color:#666"&gt;.&lt;/span&gt;dirname(&lt;span style="color:#007020"&gt;__FILE__&lt;/span&gt;),&lt;span style="color:#4070a0"&gt;&amp;#39;support&amp;#39;&lt;/span&gt;,&lt;span style="color:#4070a0"&gt;&amp;#39;**&amp;#39;&lt;/span&gt;,&lt;span style="color:#4070a0"&gt;&amp;#39;*.rb&amp;#39;&lt;/span&gt;))&lt;span style="color:#666"&gt;].&lt;/span&gt;each {&lt;span style="color:#666"&gt;|&lt;/span&gt;f&lt;span style="color:#666"&gt;|&lt;/span&gt; &lt;span style="color:#007020"&gt;require&lt;/span&gt; f}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#60add5"&gt;Spec&lt;/span&gt;&lt;span style="color:#666"&gt;::&lt;/span&gt;&lt;span style="color:#60add5"&gt;Runner&lt;/span&gt;&lt;span style="color:#666"&gt;.&lt;/span&gt;configure &lt;span style="color:#007020;font-weight:bold"&gt;do&lt;/span&gt; &lt;span style="color:#666"&gt;|&lt;/span&gt;config&lt;span style="color:#666"&gt;|&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; config&lt;span style="color:#666"&gt;.&lt;/span&gt;mock_with &lt;span style="color:#517918"&gt;:mocha&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#007020;font-weight:bold"&gt;end&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then I set up my factories (&lt;a href="http://railscasts.com/episodes/158-factories-not-fixtures"&gt;rather than fixtures&lt;/a&gt;) using &lt;a href="http://github.com/thoughtbot/factory_girl"&gt;Factory Girl&lt;/a&gt;&lt;/p&gt;</description></item><item><title>PDF Generation in Rails... The Right Way</title><link>https://quarternotecoda.com/posts/2010-02-12-pdf-generation-in-rails-the-right-way/</link><pubDate>Fri, 12 Feb 2010 00:00:00 +0000</pubDate><guid>https://quarternotecoda.com/posts/2010-02-12-pdf-generation-in-rails-the-right-way/</guid><description>&lt;p&gt;As long as we&amp;rsquo;re talking about efficiency here, one of the ways to be more efficient is to use the right tool for the job.  I&amp;rsquo;ve done PDF generation on 3 different projects but the PDF generation I did yesterday was by far the easiest.   What I thought would take me 2 days ended up taking about 3 hours (with research, etc).&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re not using Ruby to automate some part of your job or life, I feel sad for you (at least a little).   The next time you need to generate PDFs, why not try out the excellent &lt;a title="Prawn : PDF Generation Done Right" href="http://github.com/sandal/prawn" target="_blank"&gt;Prawn&lt;/a&gt; library?  Not familiar, you say?   Well, let&amp;rsquo;s dive right in, shall we?&lt;/p&gt;</description></item><item><title>The Path to Rails 3: Greenfielding new apps with the Rails 3 beta</title><link>https://quarternotecoda.com/posts/2010-02-09-the-path-to-rails-3-greenfielding-new-apps-with-the-rails-3-beta/</link><pubDate>Tue, 09 Feb 2010 00:00:00 +0000</pubDate><guid>https://quarternotecoda.com/posts/2010-02-09-the-path-to-rails-3-greenfielding-new-apps-with-the-rails-3-beta/</guid><description>&lt;p&gt;Upgrading applications is good sport and all, but everyone knows that greenfielding is where the real fun is. At least, I love greenfielding stuff a lot more than dealing with old ghetto cruft that has 1,900 test failures and 300 errors, 20,000 line controllers, and code that I’m pretty sure is actually a demon-brand of PHP.&lt;/p&gt;
&lt;p&gt;Building a totally new app in Rails 3 is relatively simple especially if you’ve done it in previous Rails versions, but there a few changes that can trip you up. In the interest of not missing a step someone may need, this post is a simple walkthrough of building a new app with Rails 3.&lt;/p&gt;</description></item></channel></rss>