jgqsmg
Last Updated: February 25, 2016
·
555
· aalvarado
Me

Open last generated migration easily in your editor

Sometimes when generating a migration we need to look for it on the db folder and autocompleting the migration name.

This skips that and opens the latest migration in the db/migrate folder:

ls db/migrate/* | tail -n1 | xargs $EDITOR

you could create it as an alias:

alias last_migration='ls db/migrate/* | tail -n1 | xargs $EDITOR'

And use it like:

$ rails generate migration add_new_table
$ last_migration

Enjoy!

Say Thanks
Respond

3 Responses
Add your response

3410

This only opens things in macvim. You should change it to use $EDITOR.

over 1 year ago ·
3411
Me

:O agreed.thanks for the tip
Added!

over 1 year ago ·
4309
Bd3f2f0e8ee0b2a4bb011cbb63635a91

Def enjoy. Thanks!

over 1 year ago ·