diff options
author | José Valim <jose.valim@gmail.com> | 2011-03-29 19:30:59 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-03-29 19:30:59 +0200 |
commit | 94907035b6a4a8e415cf19471a7ae77fac937209 (patch) | |
tree | a6f4469457102648e59b29d5cd559ebaf19b3837 | |
parent | 555d0163897601010ab1305f41ed393ec517b61e (diff) | |
download | rails-94907035b6a4a8e415cf19471a7ae77fac937209.tar.gz rails-94907035b6a4a8e415cf19471a7ae77fac937209.tar.bz2 rails-94907035b6a4a8e415cf19471a7ae77fac937209.zip |
Pass the proper method_name instead of hardcoding to action_name.
Conflicts:
actionpack/lib/action_controller/metal/implicit_render.rb
-rw-r--r-- | actionpack/lib/abstract_controller/callbacks.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/metal/implicit_render.rb | 18 |
2 files changed, 11 insertions, 9 deletions
diff --git a/actionpack/lib/abstract_controller/callbacks.rb b/actionpack/lib/abstract_controller/callbacks.rb index 1943ca4436..95992c2698 100644 --- a/actionpack/lib/abstract_controller/callbacks.rb +++ b/actionpack/lib/abstract_controller/callbacks.rb @@ -14,7 +14,7 @@ module AbstractController # Override AbstractController::Base's process_action to run the # process_action callbacks around the normal behavior. def process_action(method_name, *args) - run_callbacks(:process_action, action_name) do + run_callbacks(:process_action, method_name) do super end end diff --git a/actionpack/lib/action_controller/metal/implicit_render.rb b/actionpack/lib/action_controller/metal/implicit_render.rb index cfa7004048..4b301c0d90 100644 --- a/actionpack/lib/action_controller/metal/implicit_render.rb +++ b/actionpack/lib/action_controller/metal/implicit_render.rb @@ -1,9 +1,13 @@ module ActionController module ImplicitRender - def send_action(*) - ret = super - default_render unless response_body - ret + def send_action(method, *args) + if respond_to?(method, true) + ret = super + default_render unless response_body + ret + else + default_render + end end def default_render @@ -11,10 +15,8 @@ module ActionController end def method_for_action(action_name) - super || begin - if template_exists?(action_name.to_s, _prefixes) - "default_render" - end + super || if template_exists?(action_name.to_s, _prefixes) + action_name.to_s end end end |