aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/mime_responds.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_controller/mime_responds.rb')
-rw-r--r--actionpack/lib/action_controller/mime_responds.rb10
1 files changed, 3 insertions, 7 deletions
diff --git a/actionpack/lib/action_controller/mime_responds.rb b/actionpack/lib/action_controller/mime_responds.rb
index e1e6790381..e297cf8b07 100644
--- a/actionpack/lib/action_controller/mime_responds.rb
+++ b/actionpack/lib/action_controller/mime_responds.rb
@@ -94,7 +94,7 @@ module ActionController #:nodoc:
# and accept Rails' defaults, life will be much easier.
def respond_to(*types, &block)
raise ArgumentError, "respond_to takes either types or a block, never bot" unless types.any? ^ block
- block ||= lambda { |responder| types.each { |type| responder.send(type) } }
+ block ||= lambda { |responder| types.each { |type| responder.known(type) } }
responder = Responder.new(block.binding)
block.call(responder)
responder.respond
@@ -132,12 +132,8 @@ module ActionController #:nodoc:
end
end
- for mime_type in %w( all html js xml rss atom yaml )
- eval <<-EOT
- def #{mime_type}(&block)
- custom(Mime::#{mime_type.upcase}, &block)
- end
- EOT
+ def known(mime_type_extension, &block)
+ custom(Mime.const_get(mime_type_extension.to_s.upcase), &block)
end
def any(*args, &block)