There are plenty of shortcuts with Ruby on Rail's implementation of migrations. Adding columns, removing column, add indexes, altering table or columns to just name a few. I recently ran across a simple trick that can be utilized to add multiple columns quickly to a migration
By utilizing the following formula with the Rails generator, you can add multiple columns to a single migration.
The Rails generate command is smart enough to figure out the correct database table and construct a migration based off it. I imagine this could also be used with other migrations, not just altering an existing table.
Got a Rails generate trick or tip? Tell me about it below in the comments.comments powered by Disqus