lib/sequenced/generator.rb in sequenced-3.1.1 vs lib/sequenced/generator.rb in sequenced-3.2.0

- old
+ new

@@ -9,11 +9,11 @@ @start_at = options[:start_at] @skip = options[:skip] end def set - return if id_set? || skip? + return if skip? || id_set? lock_table record.send(:"#{column}=", next_id) end def id_set? @@ -37,11 +37,11 @@ end def unique?(id) build_scope(*scope) do rel = base_relation - rel = rel.where("NOT id = ?", record.id) if record.persisted? + rel = rel.where.not(record.class.primary_key => record.id) if record.persisted? rel.where(column => id) end.count == 0 end private @@ -52,10 +52,10 @@ end end def postgresql? defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) && - record.class.connection.instance_of?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) + record.class.connection.kind_of?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) end def base_relation record.class.base_class.unscoped end