Module: ActiveRecord::ConnectionAdapters::SchemaStatements

Defined in:
lib/ar-audit-tracer.rb

Instance Method Summary collapse

Instance Method Details

#add_authorstamps(table_name, type = :string, *args) ⇒ Object

Adds author columns (created_by and updated_by) to the named table.

Examples
add_authors(:suppliers)


14
15
16
17
18
# File 'lib/ar-audit-tracer.rb', line 14

def add_authorstamps(table_name, type=:string, *args)
  options = {:null => false}.merge(args.extract_options!)
  add_column table_name, :created_by, type, options
  add_column table_name, :updated_by, type, options
end

#remove_authorstamps(table_name) ⇒ Object

Removes the author columns (created_by and updated_by) from the table definition.

Examples
remove_authors(:suppliers)


23
24
25
26
# File 'lib/ar-audit-tracer.rb', line 23

def remove_authorstamps(table_name)
  remove_column table_name, :updated_by
  remove_column table_name, :created_by
end