aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/base.rb
diff options
context:
space:
mode:
authorwycats <wycats@gmail.com>2010-04-03 02:30:06 -0700
committerwycats <wycats@gmail.com>2010-04-03 02:44:02 -0700
commit3eb97531b8650db5cc7b9558cc3828c56a526b6a (patch)
tree70f28e707c552b3be295fff52ab387e901698825 /actionpack/lib/action_view/base.rb
parent13004d4f849682772060371273fda3312dd3b884 (diff)
downloadrails-3eb97531b8650db5cc7b9558cc3828c56a526b6a.tar.gz
rails-3eb97531b8650db5cc7b9558cc3828c56a526b6a.tar.bz2
rails-3eb97531b8650db5cc7b9558cc3828c56a526b6a.zip
Refactored url_for in AV to have its own instances of the helpers instead of proxying back to the controller. This potentially allows for more standalone usage of AV. It also kicked up a lot of dust in the tests, which were mocking out controllers to get this behavior. By moving it to the view, it made a lot of the tests more standalone (a win)
Diffstat (limited to 'actionpack/lib/action_view/base.rb')
-rw-r--r--actionpack/lib/action_view/base.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index a9b0715b2e..fde61e9df9 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -168,6 +168,8 @@ module ActionView #:nodoc:
remove_method :helpers
attr_reader :helpers
+ class_attribute :_router
+
class << self
delegate :erb_trim_mode=, :to => 'ActionView::Template::Handlers::ERB'
delegate :logger, :to => 'ActionController::Base', :allow_nil => true
@@ -204,7 +206,10 @@ module ActionView #:nodoc:
@assigns = assigns_for_first_render.each { |key, value| instance_variable_set("@#{key}", value) }
@helpers = self.class.helpers || Module.new
- @_controller = controller
+ if @_controller = controller
+ @_request = controller.request if controller.respond_to?(:request)
+ end
+
@_config = ActiveSupport::InheritableOptions.new(controller.config) if controller && controller.respond_to?(:config)
@_content_for = Hash.new { |h,k| h[k] = ActiveSupport::SafeBuffer.new }
@_virtual_path = nil