Skip to content

Commit

Permalink
Improve Flash API docs [ci-skip]
Browse files Browse the repository at this point in the history
This cross-links the `flash` method doc to the `Flash` and `FlashHash`
class docs, and fixes a code snippet formatting issue.
  • Loading branch information
jonathanhefner committed Feb 21, 2022
1 parent 2a5acb0 commit 75a9e1b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions actionpack/lib/action_dispatch/middleware/flash.rb
Expand Up @@ -20,10 +20,11 @@ module ActionDispatch
# end
# end
#
# show.html.erb
# <% if flash[:notice] %>
# <div class="notice"><%= flash[:notice] %></div>
# <% end %>
# Then in +show.html.erb+:
#
# <% if flash[:notice] %>
# <div class="notice"><%= flash[:notice] %></div>
# <% end %>
#
# Since the +notice+ and +alert+ keys are a common idiom, convenience accessors are available:
#
Expand All @@ -41,9 +42,9 @@ class Flash
KEY = "action_dispatch.request.flash_hash"

module RequestMethods
# Access the contents of the flash. Use <tt>flash["notice"]</tt> to
# read a notice you put there or <tt>flash["notice"] = "hello"</tt>
# to put a new one.
# Access the contents of the flash. Returns a ActionDispatch::Flash::FlashHash.
#
# See ActionDispatch::Flash for example usage.
def flash
flash = flash_hash
return flash if flash
Expand Down

0 comments on commit 75a9e1b

Please sign in to comment.