From 75a9e1be75769ae633a938d81d51e06852a69ea3 Mon Sep 17 00:00:00 2001 From: Jonathan Hefner Date: Wed, 16 Feb 2022 15:20:29 -0600 Subject: [PATCH] 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. --- .../lib/action_dispatch/middleware/flash.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/actionpack/lib/action_dispatch/middleware/flash.rb b/actionpack/lib/action_dispatch/middleware/flash.rb index c085feeca8..6eb2983d3a 100644 --- a/actionpack/lib/action_dispatch/middleware/flash.rb +++ b/actionpack/lib/action_dispatch/middleware/flash.rb @@ -20,10 +20,11 @@ module ActionDispatch # end # end # - # show.html.erb - # <% if flash[:notice] %> - #
<%= flash[:notice] %>
- # <% end %> + # Then in +show.html.erb+: + # + # <% if flash[:notice] %> + #
<%= flash[:notice] %>
+ # <% end %> # # 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" module RequestMethods - # Access the contents of the flash. Use flash["notice"] to - # read a notice you put there or flash["notice"] = "hello" - # 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