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