Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove order attribute from collector

Ruby 1.8 legacy. Since 1.9 hash preserves insertion order. No need for additional array to achieve this
  • Loading branch information...
commit 83f75a97e27a9ee40887c5eb167036d5b1c05056 1 parent dbc6ce3
@strzalek strzalek authored
Showing with 3 additions and 4 deletions.
  1. +3 −4 actionpack/lib/action_controller/metal/mime_responds.rb
View
7 actionpack/lib/action_controller/metal/mime_responds.rb
@@ -396,10 +396,10 @@ def retrieve_collector_from_mimes(mimes=nil, &block) #:nodoc:
# request, with this response then being accessible by calling #response.
class Collector
include AbstractController::Collector
- attr_accessor :order, :format
+ attr_accessor :format
def initialize(mimes)
- @order, @responses = [], {}
+ @responses = {}
mimes.each { |mime| send(mime) }
end
@@ -414,7 +414,6 @@ def any(*args, &block)
def custom(mime_type, &block)
mime_type = Mime::Type.lookup(mime_type.to_s) unless mime_type.is_a?(Mime::Type)
- @order << mime_type
@responses[mime_type] ||= block
end
@@ -423,7 +422,7 @@ def response
end
def negotiate_format(request)
- @format = request.negotiate_mime(order)
+ @format = request.negotiate_mime(@responses.keys)
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.