Created
August 17, 2010 17:03
-
-
Save dolzenko/530859 to your computer and use it in GitHub Desktop.
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 Responders | |
module FlashResponder | |
protected | |
def set_flash_message! | |
# Make FlashResponder set :alert flash on failed destroy action | |
if has_errors? || (delete? && !resource.destroyed?) | |
set_flash(:alert, @alert) | |
status = Responders::FlashResponder.flash_keys.last | |
else | |
set_flash(:notice, @notice) | |
status = Responders::FlashResponder.flash_keys.first | |
end | |
return if controller.flash[status].present? | |
options = mount_i18n_options(status) | |
message = ::I18n.t options[:default].shift, options | |
set_flash(status, message) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment