Class: AuditTables::CreateAuditTablesForExistingTables

Inherits:
Object
  • Object
show all
Defined in:
lib/audit_tables/create_audit_tables_for_existing_tables.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ CreateAuditTablesForExistingTables

Returns a new instance of CreateAuditTablesForExistingTables.



6
7
8
9
# File 'lib/audit_tables/create_audit_tables_for_existing_tables.rb', line 6

def initialize(options)
  @klasses = ActiveRecord::Base.connection.tables
  @klasses -= options
end

Instance Attribute Details

#klassesObject (readonly)

Returns the value of attribute klasses.



4
5
6
# File 'lib/audit_tables/create_audit_tables_for_existing_tables.rb', line 4

def klasses
  @klasses
end

Instance Method Details

#processObject



11
12
13
14
15
16
# File 'lib/audit_tables/create_audit_tables_for_existing_tables.rb', line 11

def process
  klasses.each do |klass|
    AuditTables::BuildAuditTrigger.new(klass).build
    AuditTables::CreateNewAuditTable.new(klass).build
  end
end