Changeset 4943
- Timestamp:
- 09/03/06 22:35:31 (2 years ago)
- Files:
-
- trunk/actionpack/lib/action_controller/base.rb (modified) (3 diffs)
- trunk/actionpack/test/controller/deprecation (added)
- trunk/actionpack/test/controller/deprecation/deprecated_base_methods_test.rb (added)
- trunk/actionpack/test/controller/url_rewriter_test.rb (modified) (1 diff)
- trunk/activesupport/lib/active_support/deprecation.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/lib/action_controller/base.rb
r4860 r4943 486 486 def url_for(options = {}, *parameters_for_method_reference) #:doc: 487 487 case options 488 when String then options 489 when Symbol then send(options, *parameters_for_method_reference) 490 when Hash then @url.rewrite(rewrite_options(options)) 488 when String 489 options 490 491 when Symbol 492 ActiveSupport::Deprecation.warn( 493 "WARNING: You called url_for(:#{options}), which is a deprecated API. Instead you should use the named " + 494 "route directly, like #{options}(). Using symbols and parameters with url_for will be removed from Rails 2.0." 495 ) 496 497 send(options, *parameters_for_method_reference) 498 499 when Hash 500 @url.rewrite(rewrite_options(options)) 491 501 end 492 502 end … … 662 672 raise DoubleRenderError, "Can only render or redirect once per action" if performed? 663 673 664 # Backwards compatibility 665 unless options.is_a?(Hash) 666 if options == :update 667 options = {:update => true} 668 else 669 return render_file(options || default_template_name, deprecated_status, true) 674 if options.nil? 675 return render_file(default_template_name) 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. 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 || default_template_name, deprecated_status, true) 688 end 670 689 end 671 690 end … … 876 895 response.redirected_to = options 877 896 else 897 # TOOD: Deprecate me! 878 898 redirect_to(url_for(options, *parameters_for_method_reference)) 879 899 response.redirected_to, response.redirected_to_method_params = options, parameters_for_method_reference trunk/actionpack/test/controller/url_rewriter_test.rb
r4814 r4943 91 91 ActionController::Routing::Routes.load! 92 92 end 93 94 93 end trunk/activesupport/lib/active_support/deprecation.rb
r4939 r4943 39 39 def deprecation_message(callstack, message = nil) 40 40 file, line, method = extract_callstack(callstack) 41 message ||= "WARNING: #{method} is deprecated and will be removed from Rails 2.0. " + 42 "See http://www.rubyonrails.org/deprecation for details." 43 "#{message} (#{method} at #{file}:#{line})" 41 message ||= "WARNING: #{method} is deprecated and will be removed from Rails 2.0." 42 "#{message}. See http://www.rubyonrails.org/deprecation for details. (#{method} at #{file}:#{line})" 44 43 end 45 44