lib/pupper/api_associations.rb in pupper-0.1.12 vs lib/pupper/api_associations.rb in pupper-0.1.13
- old
+ new
@@ -67,10 +67,11 @@
when :has_one
assocs[name] = create_has_one_assoc_model(name, foreign_key, value)
when :has_many
assocs[name] = create_has_many_assoc_model(name, value)
else
- assocs[:"#{name}_#{foreign_key}"] = value
+ name = foreign_key.present? ? "#{name}_#{foreign_key}" : name
+ assocs[name.to_sym] = value
end
end
def excluded_attrs
@excluded_attrs ||= []