Created
September 11, 2009 20:15
-
-
Save adkron/185537 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class BackgroundChanger | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
status, headers, response = @app.call(env) | |
response.body.gsub!('<body',"<body background='/images/common/bg-staging.gif'") if env['RAILS_ENV'] != 'production' && response.respond_to?(:body) && response.body.respond_to?(:gsub!) | |
[status, headers, response] | |
end | |
end |
This file contains hidden or 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
#add this | |
config.middleware.use BackgroundChanger |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment