Module: ActsAsAppstatsable::ClassMethods
- Defined in:
- lib/appstats/acts_as_appstatsable.rb
Instance Method Summary collapse
Instance Method Details
#acts_as_appstatsable(options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/appstats/acts_as_appstatsable.rb', line 9 def acts_as_appstatsable( = {}) self.cattr_accessor :appstats_after_create, :appstats_after_destroy, :appstats_after_update class_eval <<-EOV include ActsAsAppstatsable::InstanceMethods after_create :track_create after_destroy :track_destroy after_update :track_update EOV () end |
#acts_as_appstatsable_options(options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/appstats/acts_as_appstatsable.rb', line 23 def ( = {}) if ![:only].nil? self.appstats_after_create = [:only].include?(:create) self.appstats_after_destroy = [:only].include?(:destroy) self.appstats_after_update = [:only].include?(:update) elsif ![:except].nil? self.appstats_after_create = ![:except].include?(:create) self.appstats_after_destroy = ![:except].include?(:destroy) self.appstats_after_update = ![:except].include?(:update) else self.appstats_after_create = true self.appstats_after_destroy = true self.appstats_after_update = true end end |