diff options
author | José Valim <jose.valim@gmail.com> | 2009-12-01 13:11:24 -0200 |
---|---|---|
committer | Yehuda Katz <wycats@Yehuda-Katz.local> | 2009-12-01 08:23:43 -0800 |
commit | 6e30361260205cb7029fbc78b4a98b66a884ce45 (patch) | |
tree | e76e3a065ce1ff35e3fb092e966d52fc82f5a76f /actionpack/lib/action_controller/metal/responder.rb | |
parent | 6ac32a83283f46b55675ddf4ecab6c91f6f8abde (diff) | |
download | rails-6e30361260205cb7029fbc78b4a98b66a884ce45.tar.gz rails-6e30361260205cb7029fbc78b4a98b66a884ce45.tar.bz2 rails-6e30361260205cb7029fbc78b4a98b66a884ce45.zip |
Allow ActionController::Responder to have a common entry point for all formats.
Signed-off-by: Yehuda Katz <wycats@Yehuda-Katz.local>
Diffstat (limited to 'actionpack/lib/action_controller/metal/responder.rb')
-rw-r--r-- | actionpack/lib/action_controller/metal/responder.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/metal/responder.rb b/actionpack/lib/action_controller/metal/responder.rb index e8e88e7479..6c76c57839 100644 --- a/actionpack/lib/action_controller/metal/responder.rb +++ b/actionpack/lib/action_controller/metal/responder.rb @@ -102,9 +102,14 @@ module ActionController #:nodoc: # not defined, call to_format. # def self.call(*args) - responder = new(*args) - method = :"to_#{responder.format}" - responder.respond_to?(method) ? responder.send(method) : responder.to_format + new(*args).respond + end + + # Main entry point for responder responsible to dispatch to the proper format. + # + def respond + method = :"to_#{format}" + respond_to?(method) ? send(method) : to_format end # HTML format does not render the resource, it always attempt to render a |