Created
October 4, 2012 11:54
-
-
Save nerf/3833151 to your computer and use it in GitHub Desktop.
Override Rails redirect_to flash messages to work with Twitter Bootstrap
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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
should be placed in Rails config/initializers/bootstrap_flash_messages.rb