1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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

View file

@ -20,7 +20,8 @@ module ActionDispatch
# end # end
# end # end
# #
# show.html.erb # Then in +show.html.erb+:
#
# <% if flash[:notice] %> # <% if flash[:notice] %>
# <div class="notice"><%= flash[:notice] %></div> # <div class="notice"><%= flash[:notice] %></div>
# <% end %> # <% end %>
@ -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