Module: LogTable::ClassMethods
- Defined in:
- lib/log_table.rb
Instance Method Summary collapse
-
#add_log_trigger(options = {}) ⇒ Object
add_log_trigger will add hairtrigger triggers to the model.
Instance Method Details
#add_log_trigger(options = {}) ⇒ Object
add_log_trigger will add hairtrigger triggers to the model. It will generate triggers for :insert and :update.
Options:
-
:table_name - Specify table name of the log table.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/log_table.rb', line 51 def add_log_trigger( = {}) trigger.after(:insert) do LogStatus.sql_func(LogStatus::INSERTED, name, column_names, table_name, ) end trigger.after(:update) do LogStatus.sql_func(LogStatus::UPDATED, name, column_names, table_name, ) end trigger.after(:delete) do LogStatus.sql_func(LogStatus::DELETED, name, column_names, table_name, ) end end |