Changeset 6399
- Timestamp:
- 03/13/07 03:49:52 (3 years ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/lib/action_controller/base.rb (modified) (1 diff)
- trunk/actionpack/lib/action_view/base.rb (modified) (1 diff)
- trunk/actionpack/lib/action_view/template_error.rb (modified) (2 diffs)
- trunk/actionpack/test/controller/deprecated_instance_variables_test.rb (deleted)
- trunk/actionpack/test/controller/new_render_test.rb (modified) (1 diff)
- trunk/actionpack/test/fixtures/deprecated_instance_variables (deleted)
- trunk/actionpack/test/template/deprecated_instance_variables_test.rb (deleted)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r6397 r6399 1 1 *SVN* 2 3 * Deprecation: remove deprecated instance variables. [Jeremy Kemper] 2 4 3 5 * Consistent public/protected/private visibility for chained methods. #7813 [Dan Manges] trunk/actionpack/lib/action_controller/base.rb
r6302 r6399 1113 1113 1114 1114 @_headers = @_response.headers 1115 1116 assign_deprecated_shortcuts(request, response)1117 end1118 1119 # TODO: assigns cookies headers params request response template1120 DEPRECATED_INSTANCE_VARIABLES = %w(cookies flash headers params request response session)1121 1122 # Gone after 1.2.1123 def assign_deprecated_shortcuts(request, response)1124 DEPRECATED_INSTANCE_VARIABLES.each do |method|1125 var = "@#{method}"1126 if instance_variables.include?(var)1127 value = instance_variable_get(var)1128 unless ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy === value1129 raise "Deprecating #{var}, but it's already set to #{value.inspect}! Use the #{method}= writer method instead of setting #{var} directly."1130 end1131 end1132 instance_variable_set var, ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new(self, method)1133 end1134 1115 end 1135 1116 trunk/actionpack/lib/action_view/base.rb
r6350 r6399 158 158 159 159 attr_reader :logger, :response, :headers 160 attr_internal (*ActionController::Base::DEPRECATED_INSTANCE_VARIABLES)160 attr_internal :cookies, :flash, :headers, :params, :request, :response, :session 161 161 162 162 # Specify trim mode for the ERB compiler. Defaults to '-'. trunk/actionpack/lib/action_view/template_error.rb
r5543 r6399 11 11 base_path, assigns.dup, source, original_exception 12 12 @file_path = file_path 13 14 remove_deprecated_assigns!15 13 end 16 14 … … 83 81 84 82 private 85 def remove_deprecated_assigns!86 ActionController::Base::DEPRECATED_INSTANCE_VARIABLES.each do |ivar|87 @assigns.delete(ivar)88 end89 end90 91 83 def strip_base_path(path) 92 84 File.expand_path(path). trunk/actionpack/test/controller/new_render_test.rb
r6178 r6399 461 461 462 462 get :hello_world 463 assert assigns.include?('request'), 'request should be in assigns' 464 assert_deprecated 'request' do 465 assert_kind_of ActionController::AbstractRequest, assigns['request'] 466 end 467 assert_not_deprecated do 468 assert_kind_of ActionController::AbstractRequest, @response.template.request 469 assert_kind_of ActionController::AbstractRequest, assigns['_request'] 470 end 463 assert !assigns.include?('request'), 'request should not be in assigns' 464 assert_kind_of ActionController::AbstractRequest, assigns['_request'] 465 assert_kind_of ActionController::AbstractRequest, @response.template.request 471 466 472 467 ensure