Module: ActiveRecord::ConnectionAdapters::SchemaStatements
- Defined in:
- lib/ar-audit-tracer.rb
Instance Method Summary collapse
-
#add_authorstamps(table_name, type = :string, *args) ⇒ Object
Adds author columns (created_by and updated_by) to the named table.
-
#remove_authorstamps(table_name) ⇒ Object
Removes the author columns (created_by and updated_by) from the table definition.
Instance Method Details
#add_authorstamps(table_name, type = :string, *args) ⇒ Object
Adds author columns (created_by and updated_by) to the named table.
Examples
(:suppliers)
14 15 16 17 18 |
# File 'lib/ar-audit-tracer.rb', line 14 def (table_name, type=:string, *args) = {:null => false}.merge(args.) add_column table_name, :created_by, type, add_column table_name, :updated_by, type, end |
#remove_authorstamps(table_name) ⇒ Object
Removes the author columns (created_by and updated_by) from the table definition.
Examples
(:suppliers)
23 24 25 26 |
# File 'lib/ar-audit-tracer.rb', line 23 def (table_name) remove_column table_name, :updated_by remove_column table_name, :created_by end |