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_controller | |
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_controller')
-rw-r--r-- | actionpack/lib/action_controller/base.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/metal/rendering.rb | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index f8ddc8da09..13139358c7 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -52,7 +52,7 @@ module ActionController def method_for_action(action_name) super || begin - if view_paths.exists?(action_name.to_s, {:formats => formats}, controller_path) + if view_paths.exists?(action_name.to_s, details_for_render, controller_path) "default_render" end end diff --git a/actionpack/lib/action_controller/metal/rendering.rb b/actionpack/lib/action_controller/metal/rendering.rb index a026289ee5..6e5379745b 100644 --- a/actionpack/lib/action_controller/metal/rendering.rb +++ b/actionpack/lib/action_controller/metal/rendering.rb @@ -23,10 +23,14 @@ module ActionController def _render_partial(options) options[:partial] = action_name if options[:partial] == true - options[:_details] = {:formats => formats} + options[:_details] = details_for_render super end + def details_for_render + {:formats => formats} + end + def format_for_text formats.first end |