Module: ActiveRecord::SchemaStatements

Defined in:
lib/fingerprints/active_record.rb

Instance Method Summary collapse

Instance Method Details

#add_fingerprints(table_name) ⇒ Object

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

Examples
add_fingerprints(:suppliers)


35
36
37
38
# File 'lib/fingerprints/active_record.rb', line 35

def add_fingerprints(table_name)
  add_column table_name, :created_by, :integer
  add_column table_name, :updated_by, :integer
end

#remove_fingerprints(table_name) ⇒ Object

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

Examples
remove_fingerprints(:suppliers)


43
44
45
46
# File 'lib/fingerprints/active_record.rb', line 43

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