Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 7428

Show
Ignore:
Timestamp:
09/09/07 21:54:59 (1 year ago)
Author:
david
Message:

Removed ActionController::Base#keep_flash (use flash.keep instead)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/flash.rb

    r7383 r7428  
    11module ActionController #:nodoc: 
    22  # The flash provides a way to pass temporary objects between actions. Anything you place in the flash will be exposed 
    3   # to the very next action and then cleared out. This is a great way of doing notices and alerts, such as a create action 
    4   # that sets <tt>flash[:notice] = "Successfully created"</tt> before redirecting to a display action that can then expose  
    5   # the flash to its template. Actually, that exposure is automatically done. Example: 
     3  # to the very next action and then cleared out. This is a great way of doing notices and alerts, such as a create 
     4  # action that sets <tt>flash[:notice] = "Successfully created"</tt> before redirecting to a display action that can 
     5  # then expose the flash to its template. Actually, that exposure is automatically done. Example: 
    66  # 
    77  #   class WeblogController < ActionController::Base 
     
    2020  #     <% if flash[:notice] %><div class="notice"><%= flash[:notice] %></div><% end %> 
    2121  # 
    22   # 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 
    23   # as you like at a time too. Just remember: They'll be gone by the time the next action has been performed. 
     22  # This example just places a string in the flash, but you can put any object in there. And of course, you can put as 
     23  # many as you like at a time too. Just remember: They'll be gone by the time the next action has been performed. 
    2424  # 
    2525  # See docs on the FlashHash class for more details about the flash. 
     
    8686      # Entries set via <tt>now</tt> are accessed the same way as standard entries: <tt>flash['my-key']</tt>. 
    8787      def now 
    88         FlashNow.new self 
     88        FlashNow.new(self) 
    8989      end 
    9090     
     
    118118        end 
    119119 
    120         (@used.keys - keys).each{|k| @used.delete k } # clean up after keys that could have been left over by calling reject! or shift on the flash 
     120        # clean up after keys that could have been left over by calling reject! or shift on the flash 
     121        (@used.keys - keys).each{ |k| @used.delete(k) } 
    121122      end 
    122123     
     
    131132            @used[k] = v 
    132133          else 
    133             keys.each{|key| use key, v
     134            keys.each{ |key| use(key, v)
    134135          end 
    135136        end 
     
    137138 
    138139    module InstanceMethods #:nodoc: 
    139  
    140140      protected 
    141141        def reset_session_with_flash 
     
    164164        end 
    165165 
    166         # deprecated. use <tt>flash.keep</tt> instead 
    167         def keep_flash #:doc: 
    168           ActiveSupport::Deprecation.warn 'keep_flash is deprecated; use flash.keep instead.', caller 
    169           flash.keep 
    170         end 
    171          
    172166      private 
    173167        def assign_shortcuts_with_flash(request, response) #:nodoc: 
  • trunk/actionpack/test/controller/flash_test.rb

    r6670 r7428  
    3232      @flash_copy = {}.update flash 
    3333      @flashy = flash["that"] 
    34       silence_warnings { keep_flash } 
     34      flash.keep 
    3535      render :inline => "hello" 
    3636    end 
     
    9595    get :set_flash 
    9696     
    97     assert_deprecated(/keep_flash/) { get :use_flash_and_keep_it } 
     97    get :use_flash_and_keep_it 
    9898    assert_equal "hello", @response.template.assigns["flash_copy"]["that"] 
    9999    assert_equal "hello", @response.template.assigns["flashy"]