Module: CacheableFlash
- Included in:
- Admin::BaseController, BaseController
- Defined in:
- lib/rails_ext/action_controller/cacheable_flash.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
6 7 8 |
# File 'lib/rails_ext/action_controller/cacheable_flash.rb', line 6 def self.included(base) base.prepend_around_action :write_flash_to_cookie end |
Instance Method Details
#write_flash_to_cookie {|_self| ... } ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rails_ext/action_controller/cacheable_flash.rb', line 10 def yield self = begin JSON.parse(["flash"] || "{}") rescue JSON::ParserError {} end flash.each do |key, value| if [key.to_s].blank? [key.to_s] = value else [key.to_s] << "<br/>#{value}" # TODO should be an array end end ['flash'] = .to_json flash.clear end |