UPDATE: This is obsolete, see this post for a better solution.
Duane's comment prompted me to think about how to get the
remove_column lines inserted in the right place. I don't think TextMate's snippets are built to do this sort of text manipulation. It would be nicer, but a quick hack will suffice for now.
Use MCDT to insert:
create_table "table" do |t| end drop_table "table"
Then press tab once more after typing the table name to select the code
drop_table "table". I created a macro that cuts the selected text, finds
def self.down and pastes the line there. Then it searches for the previous occurence of
create_table and moves the cursor to the next line, ready for you to add some columns.
I have this bound to ⌃⌥⌘M because it wasn't in use. If your Control key is to the left the A key it's quite comfortable to hit this combo. Copy the following file into ~/Library/Application Support/TextMate/Bundles/Rails.tmbundle/Macros.
Move selection to self.down
This works for the MARC snippet as well. I didn't tell you the whole truth, the macro actually finds the previous occurence of
The caveat here is that if there is a
self.down and the table you just added, it will jump back to the wrong spot. It's still faster than doing it all manually, but should be improved. If you use these exclusively, the order they occur in
self.down will be opposite of that in
self.up. That means either leaving things backwards or doing the re-ordering manually. =/