lib/rabl/builder.rb in rabl-0.8.4 vs lib/rabl/builder.rb in rabl-0.8.5

- old
+ new

@@ -98,10 +98,10 @@ # child(@user => :person) { ... } # child(@users => :people) { ... } def child(data, options={}, &block) return false unless data.present? && resolve_condition(options) name, object = data_name(data), data_object(data) - include_root = is_collection?(object) && @options[:child_root] # child @users + include_root = is_collection?(object) && options.fetch(:object_root, @options[:child_root]) # child @users engine_options = @options.slice(:child_root).merge(:root => include_root) object = { object => name } if data.respond_to?(:each_pair) && object # child :users => :people @_result[name] = self.object_to_hash(object, engine_options, &block) end