なかなか賢い。
Controller.respond_to :json すると積み上がるのね確認
module ClassMethods
def respond_to(*mimes)
options = mimes.extract_options!
only_actions = Array(options.delete(:only))
except_actions = Array(options.delete(:except))
new = mimes_for_respond_to.dup
mimes.each do |mime|
mime = mime.to_sym
new[mime] = {}
new[mime][:only] = only_actions unless only_actions.empty?
new[mime][:except] = except_actions unless except_actions.empty?
end
self.mimes_for_respond_to = new.freeze
end
def clear_respond_to
self.mimes_for_respond_to = ActiveSupport::OrderedHash.new.freeze
end