Improve build_json_serializer readability a bit

This commit is contained in:
Santiago Pastorino
2013-10-30 23:37:36 -02:00
parent 4d4b820cbe
commit 616938dc63

View File

@@ -64,11 +64,7 @@ module ActionController
def build_json_serializer(resource, options)
options = default_serializer_options.merge(options || {})
serializer = options.delete(:serializer)
serializer = ActiveModel::Serializer.serializer_for(resource) if serializer.nil?
return unless serializer
if serializer = options.fetch(:serializer, ActiveModel::Serializer.serializer_for(resource))
options[:scope] = serialization_scope unless options.has_key?(:scope)
options[:resource_name] = self.controller_name if resource.respond_to?(:to_ary)
@@ -76,3 +72,4 @@ module ActionController
end
end
end
end