Bash alias for last rails migration
Due to the timestamp_name.rb format of migrations, tab completion is a nightmare. To help combat this, I throw this handy little alias in my .bashrc:
alias lastmig='echo db/migrate/`ls db/migrate -lt | head -n 2 | tail -n 1 | rev | cut -d " " -f 1 | rev`'
This allows, so long as I'm in the rails root of my app, for quick access to the most recent migration (and likely the one that I'm actively working on):
$ vim `lastmig`
Written by Shane Gibbons
Related protips
1 Response
sweet, always wondered, why its not titletimestamp.rb instead of timestamptitle.rb ... would be a lot of handier :/
thanx for the alias!
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#