Permalink
Browse files

simplify sweep now that discard and flashes are in sync

  • Loading branch information...
1 parent bdfd11e commit afd9512c0b4ff98f3fec2ff9fd78d430b2ace974 @tenderlove tenderlove committed Dec 29, 2011
Showing with 2 additions and 8 deletions.
  1. +2 −8 actionpack/lib/action_dispatch/middleware/flash.rb
@@ -182,14 +182,8 @@ def discard(k = nil)
#
# This method is called automatically by filters, so you generally don't need to care about it.
def sweep #:nodoc:
- keys.each do |k|
- unless @discard.include?(k)
- @discard << k
- else
- delete(k)
- @discard.delete(k)
- end
- end
+ @discard.each { |k| @flashes.delete k }
+ @discard.replace @flashes.keys
end
# Convenience accessor for flash[:alert]

0 comments on commit afd9512

Please sign in to comment.