Chrome cookie location« an older post

Rails and Ruby things I keep forgetting

Snippet
# List all rails migrations and their statuses
bundle exec rake db:migrate:status
 
# Undo the last migration 
bundle exec rake db:rollback
 
# Undo the last N migrations
bundle exec rake db:rollback STEP=n
 
# Run a single migration
bundle exec rake db:migrate:up VERSION=20190606020304
 
# Rerun a single migration
bundle exec rake db:migrate:redo VERSION=20190606020304
 
# clear all the gems in a gemset (useful for debugging why a dependency is failing, don't do "bundle clean")
rvm gemset empty `cat .ruby-gemset`
 
# if you need to pass in extra data in a form to a controller,
# allow in the params, then "except" before creating:
@author.update(author_params.except(:paper_id))
 
# first time you have a new DB and want to use the defined schema
bundle exec rake db:schema:load

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.