Skip to content

Commit

Permalink
More reliably determine database adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Davies committed Nov 20, 2015
1 parent a506f9c commit 0f308e0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/sequenced/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ def unique?(id)

private

def lock_table(klass)
def lock_table
if postgresql?
klass.connection.execute("LOCK TABLE #{klass.table_name} IN EXCLUSIVE MODE")
record.class.connection.execute("LOCK TABLE #{record.class.table_name} IN EXCLUSIVE MODE")
end
end

def postgresql?
ActiveRecord::Base.configurations[Rails.env]['adapter'] == 'postgresql'
record.class.connection.instance_of?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
end

def base_relation
Expand Down

0 comments on commit 0f308e0

Please sign in to comment.