Skip to content

Instantly share code, notes, and snippets.

@wakproductions
Last active June 5, 2017 19:57
Show Gist options
  • Save wakproductions/b05fd01fc985dffe5d78f657da0f962e to your computer and use it in GitHub Desktop.
Save wakproductions/b05fd01fc985dffe5d78f657da0f962e to your computer and use it in GitHub Desktop.
Rails Cheat Sheet

Show ActiveRecord SQL

Sometimes SQL doesn't show up in test environment or development. This turns it back on:

ActiveRecord::Base.logger = Logger.new(STDOUT)

Rails Database Config

config   = Rails.configuration.database_configuration
host     = config[Rails.env]["host"]
database = config[Rails.env]["database"]
username = config[Rails.env]["username"]
password = config[Rails.env]["password"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment