Skip to content

Instantly share code, notes, and snippets.

@manters2000
Last active January 21, 2016 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manters2000/1803365be5b99c6ddc62 to your computer and use it in GitHub Desktop.
Save manters2000/1803365be5b99c6ddc62 to your computer and use it in GitHub Desktop.
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