Skip to content

Instantly share code, notes, and snippets.



Last active Jan 21, 2016
What would you like to do?
Common Rails Commands
Common Rails Commands
rails new app
rails server
rails generate Scaffold name:string email:string
bundle exec rake db:migrate
rails console
bundle exec rake test
bundle exec guard init
bundle exec guard
rails generate integration_test site_layout # generate integration test like for 'site layout'
rails generate controller Users new
rails destroy controller AccountActivations
rails generate model User name:string email:string
rails generate uploader Picture
bundle exec rake db:migrate
bundle exec rake db:migrate:status
bundle exec rake db:rollback # undo db migration
rails console --sandbox # any modification will be rolled back
bundle exec rake test:models # test for models
rails generate migration add_index_to_users_email
rails generate migration add_password_digest_to_users password_digest:string
# Remove/ Reset Database
bundle exec rake db:migrate:reset
bundle exec rake db:seed # Load sample data from seeds.rb file
# do not install gem from production
bundle install --without production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.