Skip to content

Commit d5ff2bf

Browse files
authored
Merge pull request rails#48067 from shouichi/document-flash-delete
document AD::FlashHash#delete [skip ci]
2 parents ce03255 + 7b64a75 commit d5ff2bf

File tree

1 file changed

+5
-0
lines changed
  • actionpack/lib/action_dispatch/middleware

1 file changed

+5
-0
lines changed

actionpack/lib/action_dispatch/middleware/flash.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ def key?(name)
177177
@flashes.key? name.to_s
178178
end
179179

180+
# Immediately deletes the single flash entry. Use this method when you
181+
# want remove the message within the current action. See also #discard.
180182
def delete(key)
181183
key = key.to_s
182184
@discard.delete key
@@ -245,6 +247,9 @@ def keep(k = nil)
245247
#
246248
# flash.discard # discard the entire flash at the end of the current action
247249
# flash.discard(:warning) # discard only the "warning" entry at the end of the current action
250+
#
251+
# Use this method when you want to display the message in the current
252+
# action but not in the next one. See also #delete.
248253
def discard(k = nil)
249254
k = k.to_s if k
250255
@discard.merge Array(k || keys)

0 commit comments

Comments
 (0)