mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
Serializer should be available wiithing adapter to inspect attributes and assotions
This commit is contained in:
@@ -5,8 +5,10 @@ module ActiveModel
|
||||
autoload :SimpleAdapter
|
||||
autoload :NullAdapter
|
||||
|
||||
attr_reader :serializer
|
||||
|
||||
def initialize(serializer)
|
||||
@attributes = serializer.attributes
|
||||
@serializer = serializer
|
||||
end
|
||||
|
||||
def serializable_hash(options = {})
|
||||
|
||||
@@ -3,7 +3,7 @@ module ActiveModel
|
||||
class Adapter
|
||||
class SimpleAdapter < Adapter
|
||||
def to_json(options={})
|
||||
@attributes.each_with_object({}) do |(attr, value), h|
|
||||
serializer.attributes.each_with_object({}) do |(attr, value), h|
|
||||
h[attr] = value
|
||||
end.to_json # FIXME: why does passing options here cause {}?
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user