Skip to content

Instantly share code, notes, and snippets.

@javan
Created April 16, 2013 15:33
Show Gist options
  • Save javan/5396933 to your computer and use it in GitHub Desktop.
Save javan/5396933 to your computer and use it in GitHub Desktop.
Toggle features in development mode by touching various tmp/*.txt files.
# Touch tmp/caching.txt to turn on caching
if Rails.root.join('tmp/caching.txt').exist?
config.action_controller.perform_caching = true
config.cache_store = :mem_cache_store
else
config.action_controller.perform_caching = false
config.cache_store = :null_store
end
# Touch tmp/precompile.txt to test with asset precompiles. Run
# RAILS_ENV=development RAILS_GROUPS=assets rake assets:precompile
# to compile the assets, then `touch tmp/restart.txt`
if Rails.root.join('tmp/precompile.txt').exist?
config.assets.compile = false
config.assets.digest = true
config.assets.compress = false
end
# Touch tmp/mocksmtp.txt to deliver mail to MockSMTP.app
if Rails.root.join('tmp/mocksmtp.txt').exist?
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { address: 'localhost', port: 1025, domain: 'example.com' }
else
config.action_mailer.raise_delivery_errors = false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment