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.
This commit is contained in:
Jonathan Hefner 2022-02-16 15:20:29 -06:00
parent 2a5acb00cb
commit 75a9e1be75
1 changed files with 8 additions and 7 deletions

View File

@ -20,10 +20,11 @@ module ActionDispatch
# end # end
# end # end
# #
# show.html.erb # Then in +show.html.erb+:
# <% if flash[:notice] %> #
# <div class="notice"><%= flash[:notice] %></div> # <% if flash[:notice] %>
# <% end %> # <div class="notice"><%= flash[:notice] %></div>
# <% end %>
# #
# Since the +notice+ and +alert+ keys are a common idiom, convenience accessors are available: # Since the +notice+ and +alert+ keys are a common idiom, convenience accessors are available:
# #
@ -41,9 +42,9 @@ module ActionDispatch
KEY = "action_dispatch.request.flash_hash" KEY = "action_dispatch.request.flash_hash"
module RequestMethods module RequestMethods
# Access the contents of the flash. Use <tt>flash["notice"]</tt> to # Access the contents of the flash. Returns a ActionDispatch::Flash::FlashHash.
# read a notice you put there or <tt>flash["notice"] = "hello"</tt> #
# to put a new one. # See ActionDispatch::Flash for example usage.
def flash def flash
flash = flash_hash flash = flash_hash
return flash if flash return flash if flash