Module: WiserTrails::Common::ClassMethods
- Defined in:
- lib/wiser_trails/common.rb
Overview
Provides some global methods for every model class.
Instance Method Summary collapse
-
#get_hook(key) ⇒ Proc?
private
Extracts a hook from the :on option provided in Tracked::ClassMethods#tracked.
- #set_wiser_trails_class_defaults ⇒ Object private
Instance Method Details
#get_hook(key) ⇒ Proc?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Extracts a hook from the :on option provided in Tracked::ClassMethods#tracked. Returns nil when no hook exists for given action WiserTrails::Common#get_hook
146 147 148 149 150 151 152 153 |
# File 'lib/wiser_trails/common.rb', line 146 def get_hook(key) key = key.to_sym if self.activity_hooks.has_key?(key) and self.activity_hooks[key].is_a? Proc self.activity_hooks[key] else nil end end |
#set_wiser_trails_class_defaults ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
128 129 130 131 132 133 134 |
# File 'lib/wiser_trails/common.rb', line 128 def set_wiser_trails_class_defaults self.activity_owner_global = nil self.activity_account_global = nil self.activity_new_value_global = {} self.activity_hooks = {} self.activity_custom_fields_global = {} end |