mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
don't hold on to serializer
this is an optimization for now, this may have to change later.
This commit is contained in:
parent
970b542549
commit
886ada9151
@ -2,12 +2,12 @@ module ActiveModel
|
|||||||
class Serializer
|
class Serializer
|
||||||
class Adapter
|
class Adapter
|
||||||
class NullAdapter
|
class NullAdapter
|
||||||
def initialize(serializer)
|
def initialize(adapter)
|
||||||
@serializer = serializer
|
@attributes = adapter.attributes
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_json(options={})
|
def to_json(options={})
|
||||||
@serializer.attributes.each_with_object({}) do |(attr, value), h|
|
@attributes.each_with_object({}) do |(attr, value), h|
|
||||||
h[attr] = value
|
h[attr] = value
|
||||||
end.to_json # FIXME: why does passing options here cause {}?
|
end.to_json # FIXME: why does passing options here cause {}?
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user