lib/flexirest/request.rb in flexirest-1.11.1 vs lib/flexirest/request.rb in flexirest-1.11.2
- old
+ new
@@ -711,16 +711,17 @@
def new_object(attributes, name = nil, parent = nil, parent_attribute_name = nil)
@method[:options][:has_many] ||= {}
name = name.to_sym rescue nil
if @method[:options][:has_many][name]
- overridden_name = name
+ parent_name = name
object = @method[:options][:has_many][name].new
elsif @method[:options][:has_one][name]
- overridden_name = name
+ parent_name = name
object = @method[:options][:has_one][name].new
else
+ parent_name = nil
object = create_object_instance
end
object._parent = parent
object._parent_attribute_name = parent_attribute_name
@@ -733,11 +734,10 @@
if @method[:options][:rubify_names]
k = rubify_name(k)
else
k = k.to_sym
end
- overridden_name = select_name(k, overridden_name)
- set_corresponding_value(v, k, object, overridden_name)
+ set_corresponding_value(v, k, object, select_name(k, parent_name))
end
object.clean! unless object_is_class?
object
end