mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Allow to set embed options from AM::Serializer
This commit is contained in:
@@ -17,6 +17,11 @@ module ActiveModel
|
||||
yield SETTINGS
|
||||
end
|
||||
|
||||
def embed(type, options={})
|
||||
SETTINGS[:embed] = type
|
||||
SETTINGS[:include] = true if options[:include]
|
||||
end
|
||||
|
||||
def serializer_for(resource)
|
||||
if resource.respond_to?(:to_ary)
|
||||
ArraySerializer
|
||||
|
||||
Reference in New Issue
Block a user