diff options
author | Nick Sutterer <apotonick@gmail.com> | 2012-06-29 11:33:37 +0200 |
---|---|---|
committer | Nick Sutterer <apotonick@gmail.com> | 2012-06-29 11:33:37 +0200 |
commit | 1b01ab495968eb38843e21a61d32ef9a44a6d89a (patch) | |
tree | 7487d080ba2a73b2ceb2184f9feef22f08e87b4f /actionpack/lib/abstract_controller | |
parent | 809bdf342638592b0dfd2f888c7c9a4ac093d8cf (diff) | |
download | rails-1b01ab495968eb38843e21a61d32ef9a44a6d89a.tar.gz rails-1b01ab495968eb38843e21a61d32ef9a44a6d89a.tar.bz2 rails-1b01ab495968eb38843e21a61d32ef9a44a6d89a.zip |
remove AV.prepare and move all helper-related logic into the controller. this decouples the view since it no longer knows about routes internals.
this is a result of an ongoing discussion at https://github.com/rails/rails/pull/6826.
Diffstat (limited to 'actionpack/lib/abstract_controller')
-rw-r--r-- | actionpack/lib/abstract_controller/rendering.rb | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb index 7d73c6af8d..3da2834af0 100644 --- a/actionpack/lib/abstract_controller/rendering.rb +++ b/actionpack/lib/abstract_controller/rendering.rb @@ -49,9 +49,19 @@ module AbstractController module ClassMethods def view_context_class @view_context_class ||= begin - routes = _routes if respond_to?(:_routes) - helpers = _helpers if respond_to?(:_helpers) - ActionView::Base.prepare(routes, helpers) + routes = respond_to?(:_routes) && _routes + helpers = respond_to?(:_helpers) && _helpers + + Class.new(ActionView::Base) do + if routes + include routes.url_helpers + include routes.mounted_helpers + end + + if helpers + include helpers + end + end end end end |