Skip to content

Commit 75a9e1b

Browse files
Improve Flash API docs [ci-skip]
This cross-links the `flash` method doc to the `Flash` and `FlashHash` class docs, and fixes a code snippet formatting issue.
1 parent 2a5acb0 commit 75a9e1b

File tree

1 file changed

+8
-7
lines changed
  • actionpack/lib/action_dispatch/middleware

1 file changed

+8
-7
lines changed

actionpack/lib/action_dispatch/middleware/flash.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ module ActionDispatch
2020
# end
2121
# end
2222
#
23-
# show.html.erb
24-
# <% if flash[:notice] %>
25-
# <div class="notice"><%= flash[:notice] %></div>
26-
# <% end %>
23+
# Then in +show.html.erb+:
24+
#
25+
# <% if flash[:notice] %>
26+
# <div class="notice"><%= flash[:notice] %></div>
27+
# <% end %>
2728
#
2829
# Since the +notice+ and +alert+ keys are a common idiom, convenience accessors are available:
2930
#
@@ -41,9 +42,9 @@ class Flash
4142
KEY = "action_dispatch.request.flash_hash"
4243

4344
module RequestMethods
44-
# Access the contents of the flash. Use <tt>flash["notice"]</tt> to
45-
# read a notice you put there or <tt>flash["notice"] = "hello"</tt>
46-
# to put a new one.
45+
# Access the contents of the flash. Returns a ActionDispatch::Flash::FlashHash.
46+
#
47+
# See ActionDispatch::Flash for example usage.
4748
def flash
4849
flash = flash_hash
4950
return flash if flash

0 commit comments

Comments
 (0)