Skip to content

Instantly share code, notes, and snippets.

@drumsetz
Last active February 10, 2020 04:15
Show Gist options
  • Save drumsetz/04f0fe831d6b68d8ea28 to your computer and use it in GitHub Desktop.
Save drumsetz/04f0fe831d6b68d8ea28 to your computer and use it in GitHub Desktop.
# Rake Commands
'rake db:create' -- inits database based on ./config/database.yml
'rake db:migrate' -- Actually creates the database itself
'rake db:seed' -- Seeds the database based on ./db/seed.rb
'rake db:reset' -- clear data and start again
'rake notes' -- Shows comments with tags left in code
OPTIMIZE; TODO; FIXME
'rake routes' -- Shows routing from URI pattern/action to Controller
# Config Files
./config/database.yml:
Find :username -- use 'createuser --createdb <name>'
or 'sudo -u postgres createuser --createdb <name>'
# Rails Commands
'rails s' -- Starts server
-- Access website at http://localhost:3000
'bundle install' -- Used in the root directory of of a Rails app to get
all the necessary gems
'bundle exec <cmd>' -- Runs <cmd> in the context of the gems for the project
'rails g' -- short for generate: creates new models, objects, etc.
'rails d' -- short for destroy: undo generate
'rails db' -- short for dbconsole: 'psql <db_name>' when using postgres DB
'rails new <app_name> --database=postgresql'
# Ruby Commands
rspec -- Runs the test (probably based on files in spec directory?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment