mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Concrete adapter should provide serializable hash for Adapter#to_json method
This commit is contained in:
@@ -15,8 +15,8 @@ module ActiveModel
|
||||
raise NotImplementedError, 'This is abstract method. Should be implemented at concrete adapter.'
|
||||
end
|
||||
|
||||
def to_json(options = {})
|
||||
raise NotImplementedError, 'This is abstract method. Should be implemented at concrete adapter.'
|
||||
def to_json(options={})
|
||||
serializable_hash(options).to_json
|
||||
end
|
||||
|
||||
def self.adapter_for(serializer)
|
||||
|
||||
@@ -5,10 +5,6 @@ module ActiveModel
|
||||
def serializable_hash(options = {})
|
||||
{}
|
||||
end
|
||||
|
||||
def to_json(options = {})
|
||||
serializable_hash.to_json
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,10 +7,6 @@ module ActiveModel
|
||||
h[attr] = value
|
||||
end
|
||||
end
|
||||
|
||||
def to_json(options={})
|
||||
serializable_hash(options).to_json
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user