Module: Footprintable::ClassMethods
- Defined in:
- lib/footprintable/class_methods.rb
Instance Method Summary collapse
Instance Method Details
#has_footprints(options = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/footprintable/class_methods.rb', line 4 def has_footprints = {} # 触发时间 [:on] ||= [:create, :update, :destroy] # 摘取字段 [] => 所有字段 [:extract] ||= [] # 排除字段 [:except] ||= [:updated_at, :created_at] self. = ([:on]) end |
#setup_callbacks_from_options(options_on = []) ⇒ Object
15 16 17 18 19 |
# File 'lib/footprintable/class_methods.rb', line 15 def = [] .each do |action| after_commit ->(obj) { obj.create_footprint action }, on: action end end |