lib/torque/postgresql/relation.rb in torque-postgresql-3.3.3 vs lib/torque/postgresql/relation.rb in torque-postgresql-3.4.0

- old
+ new

@@ -100,11 +100,11 @@ end # Compatibility method with 5.0 unless ActiveRecord::Relation.method_defined?(:set_value) def set_value(name, value) - assert_mutability! + assert_mutability! if respond_to?(:assert_mutability!) @values[name] = value end end module ClassMethods @@ -130,9 +130,17 @@ def initialize(klass, *, **) super klass.superclass.send(:relation) if klass.define_attribute_methods && klass.superclass != ActiveRecord::Base && !klass.superclass.abstract_class? + end + + # Allow extra keyword arguments to be sent to +InsertAll+ + if Torque::PostgreSQL::AR720 + def upsert_all(attributes, **xargs) + xargs = xargs.reverse_merge(on_duplicate: :update) + ::ActiveRecord::InsertAll.execute(self, attributes, **xargs) + end end end end # Include the methos here provided and then change the constants to ensure