Sha256: 79f561b01d760e40ca5e365719368d5efd28eaebd922b2571ccc7c15acf00779
Contents?: true
Size: 557 Bytes
Versions: 6
Compression:
Stored size: 557 Bytes
Contents
class Array def to_insert_sql(batch_size=500) raise 'All element should be an ActiveRecord instance object' unless all? { |e| e.is_a?(ActiveRecord::Base) } group_by(&:class).map do |(klass, records)| klass.to_insert_sql(records, batch_size) end.join("\n") end def to_upsert_sql(batch_size=500) raise 'All element should be an ActiveRecord instance object' unless all? { |e| e.is_a?(ActiveRecord::Base) } group_by(&:class).map do |(klass, records)| klass.to_upsert_sql(records, batch_size) end.join("\n") end end
Version data entries
6 entries across 6 versions & 1 rubygems