aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@plataformatec.com.br>2012-06-30 09:37:36 -0700
committerJosé Valim <jose.valim@plataformatec.com.br>2012-06-30 09:37:36 -0700
commit350e9c6c170038a9241c96146302e82d9f74a6d2 (patch)
treea6a4c35c3ed6d24e0d423f38d188e6d243730f3e
parentcca614bc37d00abd791c27c404682682ad73af59 (diff)
parent67dd94a77492faa0ab40d4596a12a70a96858cf4 (diff)
downloadrails-350e9c6c170038a9241c96146302e82d9f74a6d2.tar.gz
rails-350e9c6c170038a9241c96146302e82d9f74a6d2.tar.bz2
rails-350e9c6c170038a9241c96146302e82d9f74a6d2.zip
Merge pull request #6908 from apotonick/av-prepare2
Av prepare2
-rw-r--r--actionpack/lib/abstract_controller/rendering.rb16
-rw-r--r--actionpack/lib/action_view/base.rb17
2 files changed, 13 insertions, 20 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
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index f98648d930..7bfbc1f0aa 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -148,7 +148,6 @@ module ActionView #:nodoc:
cattr_accessor :prefix_partial_path_with_controller_namespace
@@prefix_partial_path_with_controller_namespace = true
- class_attribute :helpers
class_attribute :_routes
class_attribute :logger
@@ -166,22 +165,6 @@ module ActionView #:nodoc:
def xss_safe? #:nodoc:
true
end
-
- # This method receives routes and helpers from the controller
- # and return a subclass ready to be used as view context.
- def prepare(routes, helpers) #:nodoc:
- Class.new(self) do
- if routes
- include routes.url_helpers
- include routes.mounted_helpers
- end
-
- if helpers
- include helpers
- self.helpers = helpers
- end
- end
- end
end
attr_accessor :view_renderer