Skip to content

Commit

Permalink
Fix combination of composite primary keys and Rails 7.0
Browse files Browse the repository at this point in the history
This method changed to have 2 arguments in Rails 7.1, and changes in #278 to support that cause this to error on Rails 7.0. Call super with the appropriate arguments on older versions of Rails.
  • Loading branch information
Connorhd authored Jan 12, 2024
1 parent 7fd9741 commit def4bd1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/activerecord_spanner_adapter/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ def self.buffered_mutations?
end

def self._insert_record values, returning = []
return super unless buffered_mutations? || (primary_key && values.is_a?(Hash))
unless buffered_mutations? || (primary_key && values.is_a?(Hash))
return super(values) if ActiveRecord.gem_version < VERSION_7_1
return super
end

# Mutations cannot be used in combination with a sequence, as mutations do not support a THEN RETURN clause.
if buffered_mutations? && sequence_name
Expand Down

0 comments on commit def4bd1

Please sign in to comment.