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

Changeset 4947

Show
Ignore:
Timestamp:
09/03/06 23:02:56 (2 years ago)
Author:
david
Message:

Deprecated old render parameter calls

Files:

Legend:

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

    r4945 r4947  
    491491          when Symbol 
    492492            ActiveSupport::Deprecation.warn( 
    493               "WARNING: You called url_for(:#{options}), which is a deprecated API. Instead you should use the named " + 
     493              "WARNING: You called url_for(:#{options}), which is a deprecated API call. Instead you should use the named " + 
    494494              "route directly, like #{options}(). Using symbols and parameters with url_for will be removed from Rails 2.0." 
    495495            ) 
     
    672672        raise DoubleRenderError, "Can only render or redirect once per action" if performed? 
    673673 
    674         # Backwards compatibility  
    675         unless options.is_a?(Hash)  
    676           if options == :update  
    677             options = {:update => true}  
    678           else  
    679             return render_file(options || default_template_name, deprecated_status, true) 
     674        if options.nil? 
     675          return render_file(default_template_name, deprecated_status, true) 
     676        else 
     677          # Backwards compatibility 
     678          unless options.is_a?(Hash) 
     679            if options == :update 
     680              options = { :update => true } 
     681            else 
     682              ActiveSupport::Deprecation.warn( 
     683                "WARNING: You called render('#{options}'), which is a deprecated API call. Instead you use " + 
     684                "render :file => #{options}. Calling render with just a string will be removed from Rails 2.0." 
     685              ) 
     686 
     687              return render_file(options, deprecated_status, true) 
     688            end 
    680689          end 
    681690        end 
  • trunk/actionpack/Rakefile

    r4865 r4947  
    3030# make sure we include the controller tests (c*) first as on some systems 
    3131# this will not happen automatically and the tests (as a whole) will error 
    32   t.test_files=Dir.glob( "test/c*/*_test.rb" ) + Dir.glob( "test/[ft]*/*_test.rb" ) 
     32  t.test_files=Dir.glob( "test/c*/**/*_test.rb" ) + Dir.glob( "test/[ft]*/*_test.rb" ) 
    3333#  t.pattern = 'test/*/*_test.rb' 
    3434  t.verbose = true 
  • trunk/actionpack/test/controller/deprecation/deprecated_base_methods_test.rb

    r4943 r4947  
    88     
    99    def deprecated_render_parameters 
    10       # render "
     10      render "fun/games/hello_world
    1111    end 
    1212     
     
    1717    def rescue_action(e) raise e end 
    1818  end 
     19 
     20  Target.template_root = File.dirname(__FILE__) + "/../../fixtures" 
    1921 
    2022  def setup 
     
    2830      get :deprecated_symbol_parameter_to_url_for 
    2931    end 
     32 
    3033    assert_redirected_to "http://example.com/superstars" 
    3134  end 
     35   
     36  def test_deprecated_render_parameters 
     37    assert_deprecated("render('fun/games/hello_world')") do 
     38      get :deprecated_render_parameters 
     39    end 
     40 
     41    assert_equal "Living in a nested world", @response.body 
     42  end 
    3243end