Create An Bash Function To Open Latest Active Record Migration

Posted by Weston Ganger on January 25, 2016

If your like me, with Rails you’ve been choked trying to type in the path to the latest migration file with those damn timestamps.

Well I have a solution for you using Bash Functions.

Add this function to your .bashrc. Just replace vim with your favourite editor.

# ~/.bashrc

  vim db/migrate/$(ls db/migrate/ | sort | tail -1)

You must be in the root of your app for the function to work correctly.

$ last_migration

Related External Links:

Posted in Linux and Tagged with migrations rails linux command-line 

Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts