diff options
author | Carlhuda <carlhuda@engineyard.com> | 2010-03-01 14:37:05 -0800 |
---|---|---|
committer | Carlhuda <carlhuda@engineyard.com> | 2010-03-01 14:37:05 -0800 |
commit | b85ea58eb561d0a0fd2b0a3dbae1dc7846961c2d (patch) | |
tree | cd6aff630ea6d1ebcbfde508fb35b8b4a1d8118b /actionpack/lib/action_view/render | |
parent | 8fbbdda52634991b047b7567fe3a8ec7c9a6c558 (diff) | |
download | rails-b85ea58eb561d0a0fd2b0a3dbae1dc7846961c2d.tar.gz rails-b85ea58eb561d0a0fd2b0a3dbae1dc7846961c2d.tar.bz2 rails-b85ea58eb561d0a0fd2b0a3dbae1dc7846961c2d.zip |
Change AV formats so they can delegate to the controller. Now users (or plugins) can override details_for_render in their controllers and add appropriate additional details. Now if only they could *do* something with those details...
Diffstat (limited to 'actionpack/lib/action_view/render')
-rw-r--r-- | actionpack/lib/action_view/render/rendering.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/render/rendering.rb b/actionpack/lib/action_view/render/rendering.rb index abc7c09991..64cc0caf11 100644 --- a/actionpack/lib/action_view/render/rendering.rb +++ b/actionpack/lib/action_view/render/rendering.rb @@ -25,7 +25,7 @@ module ActionView end template = if options[:file] - find(options[:file], {:formats => formats}) + find(options[:file], details_for_render) elsif options[:inline] handler = Template.handler_class_for_extension(options[:type] || "erb") Template.new(options[:inline], "inline template", handler, {}) @@ -34,7 +34,7 @@ module ActionView end if template - layout = find(layout, {:formats => formats}) if layout + layout = find(layout, details_for_render) if layout _render_template(template, layout, :locals => options[:locals]) end when :update @@ -44,6 +44,10 @@ module ActionView end end + def details_for_render + controller.try(:details_for_render) || {:formats => formats} + end + # You can think of a layout as a method that is called with a block. _layout_for # returns the contents that are yielded to the layout. If the user calls yield # :some_name, the block, by default, returns content_for(:some_name). If the user |