Skip to content

Instantly share code, notes, and snippets.

@nerf
Created October 4, 2012 11:54
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 nerf/3833151 to your computer and use it in GitHub Desktop.
Save nerf/3833151 to your computer and use it in GitHub Desktop.
Override Rails redirect_to flash messages to work with Twitter Bootstrap
module ActionController
module Flash
protected
def redirect_to(options = {}, response_status_and_flash = {}) #:doc:
if alert = response_status_and_flash.delete(:alert)
flash[:alert] = alert
end
if success = response_status_and_flash.delete(:success)
flash[:success] = success
end
if info = response_status_and_flash.delete(:info)
flash[:info] = info
end
if error = response_status_and_flash.delete(:error)
flash[:error] = error
end
super(options, response_status_and_flash)
end
end
end
@nerf
Copy link
Author

nerf commented Oct 4, 2012

should be placed in Rails config/initializers/bootstrap_flash_messages.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment