From fb6af2efbbebb5fcc3497aeefe0ab41c3fdde1c3 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Wed, 11 Jan 2012 20:03:48 -0700 Subject: [PATCH] Making include_associations! a public API --- lib/active_model/serializer.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/active_model/serializer.rb b/lib/active_model/serializer.rb index f55bb840..f601a409 100644 --- a/lib/active_model/serializer.rb +++ b/lib/active_model/serializer.rb @@ -366,16 +366,16 @@ module ActiveModel # object without the root. def serializable_hash node = attributes - - if _embed - _associations.each do |attr, klass| - include! attr, :node => node - end - end - + include_associations!(node) if _embed node end + def include_associations!(node) + _associations.each do |attr, klass| + include! attr, :node => node + end + end + def include!(name, options={}) hash = options[:hash] || @options[:hash] node = options[:node]