Class: Clerk::ApplicationRecord

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/clerk/application_record.rb

Class Method Summary collapse

Class Method Details

.clerk_table_name(table_name) ⇒ Object



5
6
7
8
# File 'app/models/clerk/application_record.rb', line 5

def self.clerk_table_name(table_name)
  # version = Clerk::VERSION.split(".").map.with_index{|x, i| (i==2 ? "00" : x.rjust(2, '0')) }.join
  "#{table_name}_01"
end

.clerk_table_name_nc(table_name) ⇒ Object



10
11
12
13
# File 'app/models/clerk/application_record.rb', line 10

def self.clerk_table_name_nc(table_name)
  version = Clerk::VERSION.split(".").map{|x| x.rjust(2, '0')}.join
  "#{table_name}_#{version}_#{Clerk.key_secret}"
end

.transaction(options = {}, &block) ⇒ Object



15
16
17
18
19
20
21
# File 'app/models/clerk/application_record.rb', line 15

def self.transaction(options = {}, &block)
  # were overriding all the methods that need transactions
  # these interfere with pgbouncer.  just yield the block
  yield
rescue ActiveRecord::Rollback
  # rollbacks are silently swallowed
end