<?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>Rabbit Creative &#187; Rails</title>
	<atom:link href="http://www.rabbitcreative.com/category/rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rabbitcreative.com</link>
	<description>ruby, rails, objects and &#60;del&#62;politics&#60;/del&#62; markets</description>
	<lastBuildDate>Tue, 25 Oct 2011 02:14:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Rails 3 time zones are broken.</title>
		<link>http://www.rabbitcreative.com/2011/04/01/rails-3-time-zones-are-broken/</link>
		<comments>http://www.rabbitcreative.com/2011/04/01/rails-3-time-zones-are-broken/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 22:00:21 +0000</pubDate>
		<dc:creator>Rabbit</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.rabbitcreative.com/?p=637</guid>
		<description><![CDATA[ruby-1.9.2-head :001 &#62; RUBY_VERSION =&#62; &#34;1.9.2&#34; ruby-1.9.2-head :002 &#62; Rails.version =&#62; &#34;3.0.4&#34; ruby-1.9.2-head :003 &#62; Time.zone =&#62; &#40;GMT+00:00&#41; UTC ruby-1.9.2-head :004 &#62; Time.zone = '(GMT-08:00) Pacific Time (US &#38; Canada)' =&#62; &#34;(GMT-08:00) Pacific Time (US &#38; Canada)&#34; ruby-1.9.2-head :005 &#62; Time.zone =&#62; &#40;GMT+00:00&#41; UTC ruby-1.9.2-head :001 &#62; RUBY_VERSION =&#62; &#34;1.9.2&#34; ruby-1.9.2-head :002 &#62; Rails.version =&#62; [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">ruby<span style="color:#006600; font-weight:bold;">-</span>1.9.2<span style="color:#006600; font-weight:bold;">-</span>head :001 <span style="color:#006600; font-weight:bold;">&gt;</span> RUBY_VERSION
 <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;1.9.2&quot;</span> 
ruby<span style="color:#006600; font-weight:bold;">-</span>1.9.2<span style="color:#006600; font-weight:bold;">-</span>head :002 <span style="color:#006600; font-weight:bold;">&gt;</span> Rails.<span style="color:#9900CC;">version</span>
 <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;3.0.4&quot;</span> 
ruby<span style="color:#006600; font-weight:bold;">-</span>1.9.2<span style="color:#006600; font-weight:bold;">-</span>head :003 <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">zone</span>
 <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#40;</span>GMT<span style="color:#006600; font-weight:bold;">+</span>00:00<span style="color:#006600; font-weight:bold;">&#41;</span> UTC 
ruby<span style="color:#006600; font-weight:bold;">-</span>1.9.2<span style="color:#006600; font-weight:bold;">-</span>head :004 <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">zone</span> = <span style="color:#996600;">'(GMT-08:00) Pacific Time (US &amp; Canada)'</span>
 <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;(GMT-08:00) Pacific Time (US &amp; Canada)&quot;</span> 
ruby<span style="color:#006600; font-weight:bold;">-</span>1.9.2<span style="color:#006600; font-weight:bold;">-</span>head :005 <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">zone</span>
 <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#40;</span>GMT<span style="color:#006600; font-weight:bold;">+</span>00:00<span style="color:#006600; font-weight:bold;">&#41;</span> UTC</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">ruby<span style="color:#006600; font-weight:bold;">-</span>1.9.2<span style="color:#006600; font-weight:bold;">-</span>head :001 <span style="color:#006600; font-weight:bold;">&gt;</span> RUBY_VERSION
 <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;1.9.2&quot;</span> 
ruby<span style="color:#006600; font-weight:bold;">-</span>1.9.2<span style="color:#006600; font-weight:bold;">-</span>head :002 <span style="color:#006600; font-weight:bold;">&gt;</span> Rails.<span style="color:#9900CC;">version</span>
 <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;3.0.4&quot;</span> 
ruby<span style="color:#006600; font-weight:bold;">-</span>1.9.2<span style="color:#006600; font-weight:bold;">-</span>head :003 <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">zone</span>
 <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#40;</span>GMT<span style="color:#006600; font-weight:bold;">+</span>00:00<span style="color:#006600; font-weight:bold;">&#41;</span> UTC 
ruby<span style="color:#006600; font-weight:bold;">-</span>1.9.2<span style="color:#006600; font-weight:bold;">-</span>head :004 <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">zone</span> = <span style="color:#996600;">'Pacific Time (US &amp; Canada)'</span>
 <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;Pacific Time (US &amp; Canada)&quot;</span> 
ruby<span style="color:#006600; font-weight:bold;">-</span>1.9.2<span style="color:#006600; font-weight:bold;">-</span>head :005 <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">zone</span>
 <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#40;</span>GMT<span style="color:#006600; font-weight:bold;">-</span>08:00<span style="color:#006600; font-weight:bold;">&#41;</span> Pacific <span style="color:#CC00FF; font-weight:bold;">Time</span> <span style="color:#006600; font-weight:bold;">&#40;</span>US <span style="color:#006600; font-weight:bold;">&amp;</span> Canada<span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.rabbitcreative.com/2011/04/01/rails-3-time-zones-are-broken/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 3 destroy migration examples.</title>
		<link>http://www.rabbitcreative.com/2011/03/03/rails-3-destroy-migration-examples/</link>
		<comments>http://www.rabbitcreative.com/2011/03/03/rails-3-destroy-migration-examples/#comments</comments>
		<pubDate>Thu, 03 Mar 2011 14:52:17 +0000</pubDate>
		<dc:creator>Rabbit</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.rabbitcreative.com/?p=615</guid>
		<description><![CDATA[rails generate migration name_of_the_migration_you_want_to_destroy rails destroy migration name_of_the_migration_you_want_to_destroy No need to fiddle with the timestamp prefix or the &#8220;.rb&#8221; file extension.]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">rails generate migration name_of_the_migration_you_want_to_destroy
rails destroy migration name_of_the_migration_you_want_to_destroy</pre></div></div>

<p>No need to fiddle with the timestamp prefix or the &#8220;.rb&#8221; file extension.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rabbitcreative.com/2011/03/03/rails-3-destroy-migration-examples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 3 still fucking up field_with_errors.</title>
		<link>http://www.rabbitcreative.com/2010/09/20/rails-3-still-fucking-up-field_with_errors/</link>
		<comments>http://www.rabbitcreative.com/2010/09/20/rails-3-still-fucking-up-field_with_errors/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 03:47:34 +0000</pubDate>
		<dc:creator>Rabbit</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.rabbitcreative.com/?p=478</guid>
		<description><![CDATA[Wow. I thought the arguments for using SPAN instead of DIV tags were pretty convincing. Alas, those smart guys on the Rails core team think otherwise. So, fuck them. Here&#8217;s one way to fix it in Rails 3: Inside application.rb: module Arcade class Application &#60; Rails::Application &#160; ActionView::Base.field_error_proc = Proc.new do &#124;html_tag, instance&#124; include ActionView::Helpers::RawOutputHelper [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.rabbitcreative.com/wp-content/uploads/2010/09/fuck-divs.png" alt="" title="fuck-divs" width="461" height="217" class="alignnone size-full wp-image-485" /></p>
<p>Wow. I thought the <a href="http://dev.rubyonrails.org/ticket/2210">arguments for using SPAN instead of DIV tags</a> were pretty convincing. Alas, those smart guys on the Rails core team think otherwise.</p>
<p>So, fuck them. Here&#8217;s one way to fix it in Rails 3:</p>
<p>Inside application.rb:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">module</span> Arcade
  <span style="color:#9966CC; font-weight:bold;">class</span> Application <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">Rails::Application</span>
&nbsp;
    <span style="color:#6666ff; font-weight:bold;">ActionView::Base</span>.<span style="color:#9900CC;">field_error_proc</span> = <span style="color:#CC0066; font-weight:bold;">Proc</span>.<span style="color:#9900CC;">new</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>html_tag, instance<span style="color:#006600; font-weight:bold;">|</span>
      <span style="color:#9966CC; font-weight:bold;">include</span> <span style="color:#6666ff; font-weight:bold;">ActionView::Helpers::RawOutputHelper</span>
      raw <span style="color:#006600; font-weight:bold;">%</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&lt;</span>span <span style="color:#9966CC; font-weight:bold;">class</span>=<span style="color:#996600;">&quot;field_with_errors&quot;</span><span style="color:#006600; font-weight:bold;">&gt;</span><span style="color:#008000; font-style:italic;">#{html_tag}&lt;/span&gt;)</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.rabbitcreative.com/2010/09/20/rails-3-still-fucking-up-field_with_errors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tap into ActiveRecord&#8217;s sanitization methods.</title>
		<link>http://www.rabbitcreative.com/2010/04/20/tap-into-activerecords-sanitization-methods/</link>
		<comments>http://www.rabbitcreative.com/2010/04/20/tap-into-activerecords-sanitization-methods/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 17:15:45 +0000</pubDate>
		<dc:creator>Rabbit</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.rabbitcreative.com/?p=445</guid>
		<description><![CDATA[Object instantiation is expensive. object.association.create&#40;...&#41; But at the same time you get the power of ActiveRecord&#8217;s beautiful sanitization methods. Now you can have that same power without as much overhead. values = ActiveRecord::Base.send&#40;:sanitize_sql_array, &#91; '?, ?, ?', x, y, z &#93;&#41; Familiar syntax is familiar. Now use it. ActiveRecord::Base.connection.execute&#40;%&#123;INSERT INTO objects &#40;x, y, z&#41; VALUES [...]]]></description>
			<content:encoded><![CDATA[<p>Object instantiation is expensive.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">object.<span style="color:#9900CC;">association</span>.<span style="color:#9900CC;">create</span><span style="color:#006600; font-weight:bold;">&#40;</span>...<span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>But at the same time you get the power of ActiveRecord&#8217;s beautiful sanitization methods. Now you can have that same power without as much overhead.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">values = <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>.<span style="color:#9900CC;">send</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:sanitize_sql_array</span>, <span style="color:#006600; font-weight:bold;">&#91;</span> <span style="color:#996600;">'?, ?, ?'</span>, x, y, z <span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>Familiar syntax is familiar. Now use it.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>.<span style="color:#9900CC;">connection</span>.<span style="color:#9900CC;">execute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">%</span><span style="color:#006600; font-weight:bold;">&#123;</span>INSERT INTO objects <span style="color:#006600; font-weight:bold;">&#40;</span>x, y, z<span style="color:#006600; font-weight:bold;">&#41;</span> VALUES <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#008000; font-style:italic;">#{ values })})</span></pre></div></div>

<p>Presto beautiful!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rabbitcreative.com/2010/04/20/tap-into-activerecords-sanitization-methods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>You talk too much.</title>
		<link>http://www.rabbitcreative.com/2010/01/12/you-talk-too-much/</link>
		<comments>http://www.rabbitcreative.com/2010/01/12/you-talk-too-much/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 22:18:42 +0000</pubDate>
		<dc:creator>Rabbit</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.rabbitcreative.com/?p=346</guid>
		<description><![CDATA[Trying to dump data from SQLite3 and import that data into MySQL? This post can be summed up thusly: script/plugin install git://github.com/adamwiggins/yaml_db.git rake db:dump rake db:create Update config/database.yml rake db:load But that&#8217;s just me. When I look at the commands above I know the context in which they should be used, therefore I want only [...]]]></description>
			<content:encoded><![CDATA[<p>Trying to dump data from SQLite3 and import that data into MySQL? <a href="http://blog.heroku.com/archives/2007/11/23/yamldb_for_databaseindependent_data_dumps/">This post</a> can be summed up thusly:</p>
<p><code>script/plugin install git://github.com/adamwiggins/yaml_db.git</code></p>
<p><code>rake db:dump</code><br />
<code>rake db:create</code></p>
<p>Update config/database.yml</p>
<p><code>rake db:load</code></p>
<p>But that&#8217;s just me. When I look at the commands above I know the context in which they should be used, therefore I want only that which is most pertinent.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rabbitcreative.com/2010/01/12/you-talk-too-much/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

