aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/mime_responds.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-03-07 11:17:05 +0000
committerPratik Naik <pratiknaik@gmail.com>2008-03-07 11:17:05 +0000
commit011e4694107f294e2b57cd885f9917205fccdcff (patch)
treedbefbd42d08f6ae1c9c732423bd30125e2a4e241 /actionpack/lib/action_controller/mime_responds.rb
parent867063134fb903046d9eac27755a67204a26e148 (diff)
downloadrails-011e4694107f294e2b57cd885f9917205fccdcff.tar.gz
rails-011e4694107f294e2b57cd885f9917205fccdcff.tar.bz2
rails-011e4694107f294e2b57cd885f9917205fccdcff.zip
Make MimeResponds::Responder#any work without explicit types. Closes #11140 [jaw6]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8987 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/mime_responds.rb')
-rw-r--r--actionpack/lib/action_controller/mime_responds.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/mime_responds.rb b/actionpack/lib/action_controller/mime_responds.rb
index 4ba4e626e2..a17782cafc 100644
--- a/actionpack/lib/action_controller/mime_responds.rb
+++ b/actionpack/lib/action_controller/mime_responds.rb
@@ -125,7 +125,7 @@ module ActionController #:nodoc:
@order << mime_type
- @responses[mime_type] = Proc.new do
+ @responses[mime_type] ||= Proc.new do
@response.template.template_format = mime_type.to_sym
@response.content_type = mime_type.to_s
block_given? ? block.call : @controller.send(:render, :action => @controller.action_name)
@@ -133,7 +133,11 @@ module ActionController #:nodoc:
end
def any(*args, &block)
- args.each { |type| send(type, &block) }
+ if args.any?
+ args.each { |type| send(type, &block) }
+ else
+ custom(@mime_type_priority.first, &block)
+ end
end
def method_missing(symbol, &block)