Allow to set embed options from AM::Serializer

This commit is contained in:
Santiago Pastorino
2013-09-15 20:29:43 -03:00
parent aa23e811cc
commit 10e882a14f
3 changed files with 12 additions and 3 deletions

View File

@@ -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