lib/active_remote/association.rb in active_remote-6.0.2 vs lib/active_remote/association.rb in active_remote-6.0.3
- old
+ new
@@ -37,11 +37,11 @@
foreign_key = options.fetch(:foreign_key) { :"#{klass.name.demodulize.underscore}_guid" }
search_hash = {}
search_hash[:guid] = object.send(foreign_key)
search_hash[options[:scope]] = object.send(options[:scope]) if options.key?(:scope)
- search_hash.values.any?(&:nil?) ? nil : klass.search(search_hash).first
+ search_hash.values.any?(&:nil?) ? nil : klass.search(**search_hash).first
end
end
# Create a `has_many` association for a given remote resource.
# Specify one or more associations to define. The constantized
@@ -78,11 +78,11 @@
foreign_key = options.fetch(:foreign_key) { :"#{object.class.name.demodulize.underscore}_guid" }
search_hash = {}
search_hash[foreign_key] = object.guid
search_hash[options[:scope]] = object.send(options[:scope]) if options.key?(:scope)
- search_hash.values.any?(&:nil?) ? [] : klass.search(search_hash)
+ search_hash.values.any?(&:nil?) ? [] : klass.search(**search_hash)
end
options[:has_many] = true
create_association_writer(has_many_class, options)
end
@@ -118,10 +118,10 @@
foreign_key = options.fetch(:foreign_key) { :"#{object.class.name.demodulize.underscore}_guid" }
search_hash = {}
search_hash[foreign_key] = object.guid
search_hash[options[:scope]] = object.send(options[:scope]) if options.key?(:scope)
- search_hash.values.any?(&:nil?) ? nil : klass.search(search_hash).first
+ search_hash.values.any?(&:nil?) ? nil : klass.search(**search_hash).first
end
end
# when requiring an attribute on your search, we verify the attribute
# exists on both models