active_model_serializers/lib/active_model/serializer/adapter/null_adapter.rb
Steve Klabnik 886ada9151 don't hold on to serializer
this is an optimization for now, this may have to change later.
2014-07-09 23:05:41 -04:00

18 lines
405 B
Ruby

module ActiveModel
class Serializer
class Adapter
class NullAdapter
def initialize(adapter)
@attributes = adapter.attributes
end
def to_json(options={})
@attributes.each_with_object({}) do |(attr, value), h|
h[attr] = value
end.to_json # FIXME: why does passing options here cause {}?
end
end
end
end
end