You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a rails app using a specific version of rails
$ rails_3.2.11_newAngularRaffler
Check what is available on current RVM and update if required.
# Check what is known to RVM
$ rvmlistknown# If you don't see a specific version in there, ex. ruby 2.0.0-p247# Execute below command to update the list
$ rvmgetstable# You should now see the new version of ruby.
Rake task to drop, create, migrate & seed db in development mode.
# Place below code snippet in the file /lib/tasks/db.rakenamespace:dbdodesc"Drop, create, migrate then seed the database"task:rdb=>:environmentdoRails.env='development'Rake::Task['db:drop'].invokeRake::Task['db:create'].invokeRake::Task['db:migrate'].invokeRake::Task['db:seed'].invokeendend# Execute below command to run the task
$ rakedb:rdb
Generate rdoc documentation.
# Generate the documentaion for app folder.
$ rdocapp --opdoc/app --all
Production commands
# db:seed
$ rakedb:seedRAILS_ENV="production"# db:migrate
$ rakedb:migrateRAILS_ENV="production"# start server in production mode
$ railsserver -eproduction# start console in production mode
$ bundleexecrailscproduction
Allow slug with a dot(.)
# Use below regular expression in routes.rbresources:users,:only=>[:index,:show,:edit,:update,:destroy],:id=>/[\w.]+/
# PG::Error: ERROR: could not open extension control file # "/usr/share/postgresql/9.1/extension/hstore.control": No such file or directory
$ sudoapt-getinstallpostgresql-contrib
Unicorn kill process
# Helpful when code chagnes don't reflect after cap deploy.# Old unicorn processes keep serving previous version.
$ psaux | grep'unicorn' | awk'{print $2}' | xargssudokill -9