Created
March 17, 2016 13:57
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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