diff options
| author | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-05-15 15:57:12 -0700 |
|---|---|---|
| committer | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-05-15 15:57:12 -0700 |
| commit | 7e10504bdeab14ea70a942110a1b1ef6d8467ed3 (patch) | |
| tree | ee0794eff8073fc91ca5bc38cbba87b92b65a8af /actionpack/lib/action_controller/new_base | |
| parent | eb021707f53be46140b55a48e5ef03ed0577a45c (diff) | |
| download | rails-7e10504bdeab14ea70a942110a1b1ef6d8467ed3.tar.gz rails-7e10504bdeab14ea70a942110a1b1ef6d8467ed3.tar.bz2 rails-7e10504bdeab14ea70a942110a1b1ef6d8467ed3.zip | |
Refactored AbstractController to provide better hook points for overriding aspects of action dispatching
Diffstat (limited to 'actionpack/lib/action_controller/new_base')
| -rw-r--r-- | actionpack/lib/action_controller/new_base/base.rb | 16 | ||||
| -rw-r--r-- | actionpack/lib/action_controller/new_base/compatibility.rb | 18 |
2 files changed, 19 insertions, 15 deletions
diff --git a/actionpack/lib/action_controller/new_base/base.rb b/actionpack/lib/action_controller/new_base/base.rb index 1adcc9c71f..3ee17769a8 100644 --- a/actionpack/lib/action_controller/new_base/base.rb +++ b/actionpack/lib/action_controller/new_base/base.rb @@ -114,14 +114,22 @@ module ActionController super(url, status) end - def process_action + def process_action(method_name) ret = super render if response_body.nil? ret end - - def respond_to_action?(action_name) - super || view_paths.find_by_parts?(action_name.to_s, {:formats => formats, :locales => [I18n.locale]}, controller_path) + + def _implicit_render + render + end + + def method_for_action(action_name) + super || begin + if view_paths.find_by_parts?(action_name.to_s, {:formats => formats, :locales => [I18n.locale]}, controller_path) + "_implicit_render" + end + end end end end
\ No newline at end of file diff --git a/actionpack/lib/action_controller/new_base/compatibility.rb b/actionpack/lib/action_controller/new_base/compatibility.rb index 993e571aba..9884ed12e5 100644 --- a/actionpack/lib/action_controller/new_base/compatibility.rb +++ b/actionpack/lib/action_controller/new_base/compatibility.rb @@ -69,17 +69,13 @@ module ActionController super end - - def respond_to_action?(action_name) - if respond_to?(:method_missing) && !respond_to?(:action_missing) - self.class.class_eval do - private - def action_missing(name, *args) - method_missing(name.to_sym, *args) - end - end - end - super + + def _handle_method_missing + method_missing(@_action_name.to_sym) + end + + def method_for_action(action_name) + super || (respond_to?(:method_missing) && "_handle_method_missing") end def _layout_for_name(name) |
