"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "activerecord/lib/active_record/insert_all.rb" between
rails-6.1.3.2.tar.gz and rails-6.1.4.tar.gz

About: Ruby on Rails is a web application development framework (written in Ruby).

insert_all.rb  (rails-6.1.3.2):insert_all.rb  (rails-6.1.4)
skipping to change at line 71 skipping to change at line 71
keys.map do |key| keys.map do |key|
yield key, attributes[key] yield key, attributes[key]
end end
end end
end end
private private
attr_reader :scope_attributes attr_reader :scope_attributes
def find_unique_index_for(unique_by) def find_unique_index_for(unique_by)
return unique_by if !connection.supports_insert_conflict_target? if !connection.supports_insert_conflict_target?
return if unique_by.nil?
raise ArgumentError, "#{connection.class} does not support :unique_by"
end
name_or_columns = unique_by || model.primary_key name_or_columns = unique_by || model.primary_key
match = Array(name_or_columns).map(&:to_s) match = Array(name_or_columns).map(&:to_s)
if index = unique_indexes.find { |i| match.include?(i.name) || i.columns == match } if index = unique_indexes.find { |i| match.include?(i.name) || i.columns == match }
index index
elsif match == primary_keys elsif match == primary_keys
unique_by.nil? ? nil : ActiveRecord::ConnectionAdapters::IndexDefiniti on.new(model.table_name, "#{model.table_name}_primary_key", true, match) unique_by.nil? ? nil : ActiveRecord::ConnectionAdapters::IndexDefiniti on.new(model.table_name, "#{model.table_name}_primary_key", true, match)
else else
raise ArgumentError, "No unique index found for #{name_or_columns}" raise ArgumentError, "No unique index found for #{name_or_columns}"
 End of changes. 1 change blocks. 
1 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)