Generating Migrations just got easier for me

I wanted to add a column "content" to the user's table. Most of us run the following to create a migration:

script/generate migration addContentToUsers


That creates a migration with the following:

class AddContentToUsers < ActiveRecord::Migration
def self.up
end

def self.down
end
end



What's generated is pretty green, so we'd have to add some add_column/remove_column statements like so:

class AddContentToUsers < ActiveRecord::Migration
def self.up
add_column :users, :content, :text
end


Lots of not needed work. Why not just enter what we want onto the commandline when we run our migration? Enter the cool generator way of creating a simple migration:

script/generate migration AddContentToUsers content:string


This generates a sweet, simple migration like this:

class AddContentToUsers < ActiveRecord::Migration
def self.up
add_column :users, :content, :string
end

def self.down
remove_column :users, :content
end
end


Hot. Thanks for pointing this out l4rk

Gem: eycap

For some odd reason, I had to put double-quotes around the URL for the source in the following for the EngineYard gem that helps with deployment

gem install eycap --source "http://gems.engineyard.com"

Plugin: ResourceController

The Mechnical Turk from Argument from design wrote this sweet ass plugin. It cleans up your controllers, removes redundancy -- hot!


http://svn.ardes.com/resources_controller/trunk/resources_controller/