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!
Written by Adan Alvarado
Related protips
3 Responses
This only opens things in macvim. You should change it to use $EDITOR.
over 1 year ago
·

:O agreed.thanks for the tip
Added!
over 1 year ago
·

Def enjoy. Thanks!
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#