The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Conventions Uber Alles

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Rick DeNatale

Posts: 269
Nickname: rdenatale
Registered: Sep, 2007

Rick DeNatale is a consultant with over three decades of experience in OO technology.
Conventions Uber Alles Posted: Sep 11, 2007 10:27 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Rick DeNatale.
Original Post: Conventions Uber Alles
Feed Title: Talk Like A Duck
Feed URL: http://talklikeaduck.denhaven2.com/articles.atom
Feed Description: Musings on Ruby, Rails, and other topics by an experienced object technologist.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Rick DeNatale
Latest Posts From Talk Like A Duck

Advertisement
One of the Rails mantras is “Convention over configuration.” Today I bumped up against that one in spades.

Being an agile sort of guy, I tend to make frequent small refactorings, ofen this involves renaming things. I’m working on a project which will involve talking to a remote legacy database. I’m building migrations to set up a local development database which mirrors the schema of this database. I’d already generated a migration, and while working on it decided that it needed to be renamed. So I changed it to something like “007_create_LEG_Frammis_table.rb” since the legacy table had the name (changed to protect the guilty) of LEG_Frammis.

I was shocked when I ran rake db:migrate only to find that rake blew up. Turning on the—trace option to rake showed that it wasn’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.

A quick look at the code didn’t reveal an obvious reason, so I broke out ruby-debug and ran rake under rdebug.

It turns out that rails REALLY expects migration names to match the regular expression /([0-9]+)_([_a-z0-9]*).rb/, those uppercase characters were the culprits.

Read: Conventions Uber Alles

Topic: Seattle.rb batting 1000? Previous Topic   Next Topic Topic: Si sólo existiera un J2EE Rumble/Day...

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use