You may not have noticed this yet, but Rails 2.0 has a new convenient syntax for generating ActiveRecord migrations. Go ahead, run the migration generator with script/generate migration. I'll wait.

Yup, you can now specify the columns you want to add in your migration by passing attribute/type pairs to the migration generator. Ergo,

script/generate migration AddMoreToAnime episodes:integer licensed:boolean

will generate a migration like so:

class AddMoreToAnime < ActiveRecord::Migration
  def self.up
    add_column :animes, :episodes, :integer
    add_column :animes, :licensed, :boolean

  def self.down
    remove_column :animes, :licensed
    remove_column :animes, :episodes

This ties in pretty nicely with the syntax for the model generator (script/generate model), which also accepts attribute pairs. Tiny change but "it's all about consistency".

For the geeks among you, check out the related changeset and ticket.

About the contributor, Pratik Naik

Pratik Naik (WorkingWithRails profile), probably better known as lifofifo or just lifo, is an active Rails contributor and can be found on #rails-contrib and #rubyonrails nearly 24/7. Almost everyone who's used Rails has used code that lifo has written. Oh, and lifo also won one of the monthly Rails Hackfests.

He also keeps a pretty good blog where he posts mostly on Rails hacking and tips.