lib/seed-fu/seeder.rb in seed-fu-2.3.7 vs lib/seed-fu/seeder.rb in seed-fu-2.3.9
- old
+ new
@@ -89,10 +89,11 @@
return if @model_class.primary_key.nil? || @model_class.sequence_name.nil?
quoted_id = @model_class.connection.quote_column_name(@model_class.primary_key)
sequence = @model_class.sequence_name
- if @model_class.connection.postgresql_version >= 100000
+ # TODO postgresql_version was made public in Rails 5.0.0, remove #send when support for earlier versions are dropped
+ if @model_class.connection.send(:postgresql_version) >= 100000
sql =<<-EOS
SELECT setval('#{sequence}', (SELECT GREATEST(MAX(#{quoted_id})+(SELECT seqincrement FROM pg_sequence WHERE seqrelid = '#{sequence}'::regclass), (SELECT seqmin FROM pg_sequence WHERE seqrelid = '#{sequence}'::regclass)) FROM #{@model_class.quoted_table_name}), false)
EOS
else
sql =<<-EOS