Skip to content

Instantly share code, notes, and snippets.

@elyalvarado
Created March 17, 2016 13:57
Show Gist options
  • Save elyalvarado/68de5a599385079c7b43 to your computer and use it in GitHub Desktop.
Save elyalvarado/68de5a599385079c7b43 to your computer and use it in GitHub Desktop.
Create this in the config/initializers folder file and add it to .gitignore and you would be able to change configuration values in your local Rails development environment without affecting other developers, you can even "decorate" application classes to customize results
# Override configuration options here
Rails.application.config.force_ssl = false
Rails.application.config.action_controller.asset_host = nil
Rails.application.config.action_mailer.asset_host = nil
# Decorators to override Application Classes
Rails.application.config.to_prepare do
# Override sessions controller to automatically login as the first user
SessionsController.class_eval do
def new
if request.host == 'localhost' && Rails.env.development?
Rails.logger.info "Overriding login in development environment"
log_in User.first
redirect_to root_url
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment