diff options
Diffstat (limited to 'actionpack/lib/action_controller/flash.rb')
-rw-r--r-- | actionpack/lib/action_controller/flash.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/flash.rb b/actionpack/lib/action_controller/flash.rb index 9856dbed2a..56ee9c67e2 100644 --- a/actionpack/lib/action_controller/flash.rb +++ b/actionpack/lib/action_controller/flash.rb @@ -4,20 +4,22 @@ module ActionController #:nodoc: # action that sets <tt>flash[:notice] = "Successfully created"</tt> before redirecting to a display action that can # then expose the flash to its template. Actually, that exposure is automatically done. Example: # - # class WeblogController < ActionController::Base + # class PostsController < ActionController::Base # def create # # save post # flash[:notice] = "Successfully created post" - # redirect_to :action => "display", :params => { :id => post.id } + # redirect_to posts_path(@post) # end # - # def display + # def show # # doesn't need to assign the flash notice to the template, that's done automatically # end # end # - # display.erb - # <% if flash[:notice] %><div class="notice"><%= flash[:notice] %></div><% end %> + # show.html.erb + # <% if flash[:notice] %> + # <div class="notice"><%= flash[:notice] %></div> + # <% end %> # # This example just places a string in the flash, but you can put any object in there. And of course, you can put as # many as you like at a time too. Just remember: They'll be gone by the time the next action has been performed. |