mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 14:29:31 +00:00
Making include_associations! a public API
This commit is contained in:
parent
573be9302d
commit
fb6af2efbb
@ -366,16 +366,16 @@ module ActiveModel
|
|||||||
# object without the root.
|
# object without the root.
|
||||||
def serializable_hash
|
def serializable_hash
|
||||||
node = attributes
|
node = attributes
|
||||||
|
include_associations!(node) if _embed
|
||||||
if _embed
|
|
||||||
_associations.each do |attr, klass|
|
|
||||||
include! attr, :node => node
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
node
|
node
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def include_associations!(node)
|
||||||
|
_associations.each do |attr, klass|
|
||||||
|
include! attr, :node => node
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def include!(name, options={})
|
def include!(name, options={})
|
||||||
hash = options[:hash] || @options[:hash]
|
hash = options[:hash] || @options[:hash]
|
||||||
node = options[:node]
|
node = options[:node]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user