Skip to content

Instantly share code, notes, and snippets.

@kaichen
Created March 19, 2011 12:00
Show Gist options
  • Select an option

  • Save kaichen/877431 to your computer and use it in GitHub Desktop.

Select an option

Save kaichen/877431 to your computer and use it in GitHub Desktop.
a function for rails 2 & 3 via rails 3 cli interface
org_rails_cmd=`which rails`
function rails {
if [ $# -eq 0 ];then
$org_rails_cmd
elif [ -e script/rails ]; then
./script/rails $@
elif [ $1 = 'c' ];then
shift
./script/console $@
elif [ $1 = 's' ];then
shift
./script/server $@
elif [ $1 = 'g' ];then
shift
./script/generate $@
elif [ $1 = 'db' ];then
shift
./script/dbconsole $@
else
./script/$@
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment