Skip to content

Instantly share code, notes, and snippets.

@adkron
Created September 11, 2009 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adkron/185537 to your computer and use it in GitHub Desktop.
Save adkron/185537 to your computer and use it in GitHub Desktop.
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
#add this
config.middleware.use BackgroundChanger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment