aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/base.rb
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2009-07-19 21:53:02 +0900
committerYehuda Katz <wycats@gmail.com>2009-07-19 21:53:02 +0900
commitbb530923bcd5c643f9bfca8e36cd3fa36365032d (patch)
treee5d821e7f13334a64a3936d0a484bbcd8667552f /actionpack/lib/action_view/base.rb
parent1a2946a6d9b1dbcf3a4c77654693d73f9b11bde1 (diff)
downloadrails-bb530923bcd5c643f9bfca8e36cd3fa36365032d.tar.gz
rails-bb530923bcd5c643f9bfca8e36cd3fa36365032d.tar.bz2
rails-bb530923bcd5c643f9bfca8e36cd3fa36365032d.zip
Simplify required "ActionView compliant" API
Diffstat (limited to 'actionpack/lib/action_view/base.rb')
-rw-r--r--actionpack/lib/action_view/base.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index 45184f58fb..5915337dd2 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -228,6 +228,12 @@ module ActionView #:nodoc:
end
end
+ def self.for_controller(controller)
+ new(controller.class.view_paths, {}, controller).tap do |view|
+ view.helpers.include(controller._helpers) if controller.respond_to?(:_helpers)
+ end
+ end
+
def initialize(view_paths = [], assigns_for_first_render = {}, controller = nil, formats = nil)#:nodoc:
@formats = formats || [:html]
@assigns = assigns_for_first_render.each { |key, value| instance_variable_set("@#{key}", value) }