aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/abstract/renderer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_controller/abstract/renderer.rb')
-rw-r--r--actionpack/lib/action_controller/abstract/renderer.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/abstract/renderer.rb b/actionpack/lib/action_controller/abstract/renderer.rb
new file mode 100644
index 0000000000..7999bc1b70
--- /dev/null
+++ b/actionpack/lib/action_controller/abstract/renderer.rb
@@ -0,0 +1,25 @@
+module AbstractController
+ module Renderer
+
+ def self.included(klass)
+ klass.extend ClassMethods
+ klass.extlib_inheritable_accessor :view_paths
+ klass.view_paths ||= ActionView::PathSet.new
+ end
+
+ def _action_view
+ @_action_view ||= ActionView::Base.new(self.class.view_paths, {}, self)
+ end
+
+ def render(template)
+ tmp = view_paths.find_by_parts(template)
+ self.response_body = _action_view._render_template_with_layout(tmp)
+ end
+
+ module ClassMethods
+ def append_view_path(path)
+ self.view_paths << path
+ end
+ end
+ end
+end \ No newline at end of file