<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Talk Like A Duck: Conventions Uber Alles</title>
    <link>http://talklikeaduck.denhaven2.com/articles/2007/09/11/conventions-uber-alles</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>In Ruby, it's not the dog, it's the tricks!</description>
    <item>
      <title>Conventions Uber Alles</title>
      <description>One of the Rails mantras is &amp;#8220;Convention over configuration.&amp;#8221;  Today I bumped up against that one in spades.
&lt;p&gt;Being an agile sort of guy, I tend to make frequent small refactorings, ofen this involves renaming things. I&amp;#8217;m working on a project which will involve talking to a remote legacy database.  I&amp;#8217;m building migrations to set up a
local development database which mirrors the schema of this database.  I&amp;#8217;d already generated a migration, and while
working on it decided that it needed to be renamed.  So I changed it to something like &amp;#8220;007_create_LEG_Frammis_table.rb&amp;#8221;  since the legacy table had the name (changed to protect the guilty) of &lt;span class="caps"&gt;LEG&lt;/span&gt;_Frammis.&lt;/p&gt;
&lt;p&gt;I was shocked when I ran rake db:migrate only to find that rake blew up.  Turning on the&amp;#8212;trace option to rake
showed that it wasn&amp;#8217;t even getting to my migration code. Instead some code in vendor/rails/activerecord/lib/active_record/migration.rb was getting an unexpected nil and trying to send the message first to it.&lt;/p&gt;
&lt;p&gt;A quick look at the code didn&amp;#8217;t reveal an obvious reason, so I broke out ruby-debug and ran rake under rdebug.&lt;/p&gt;
&lt;p&gt;It turns out that rails &lt;span class="caps"&gt;REALLY&lt;/span&gt; expects migration names to match the regular expression /([0-9]+)_([_a-z0-9]*).rb/, those uppercase characters were the culprits.&lt;/p&gt;
&lt;h2&gt;Update&lt;/h2&gt;
&lt;p&gt;The &lt;a href="http://dev.rubyonrails.org/ticket/9542"&gt;patch&lt;/a&gt;, which Ben mentioned that he submitted in his comment, has been turned down because it would violate the assumption that round trips can be made between class names and file names.&lt;/p&gt;</description>
      <pubDate>Tue, 11 Sep 2007 19:24:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:a2286697-1ebf-4a8d-93f1-f834714baf93</guid>
      <author>Rick DeNatale</author>
      <link>http://talklikeaduck.denhaven2.com/articles/2007/09/11/conventions-uber-alles</link>
      <category>rails</category>
      <trackback:ping>http://talklikeaduck.denhaven2.com/articles/trackback/462</trackback:ping>
    </item>
    <item>
      <title>"Conventions Uber Alles" by Ben</title>
      <description>&lt;p&gt;Just submitted a patch for this, Rick. Hopefully it won&amp;#8217;t bite anyone else :)&lt;/p&gt;</description>
      <pubDate>Wed, 12 Sep 2007 08:09:40 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:2485b76e-7c5e-427f-bc87-ccc8b4ba3b95</guid>
      <link>http://talklikeaduck.denhaven2.com/articles/2007/09/11/conventions-uber-alles#comment-917</link>
    </item>
  </channel>
</rss>
