Module: IfdTools::Analytics::Trackable
- Defined in:
- lib/ifd_tools/analytics/trackable.rb
Class Method Summary collapse
Instance Method Summary collapse
- #trackable_activity ⇒ Object
-
#trackable_resource ⇒ Object
Override if you might want to link to something else.
- #trackable_title ⇒ Object
- #trackable_type ⇒ Object
Class Method Details
.included(base) ⇒ Object
5 6 7 8 9 |
# File 'lib/ifd_tools/analytics/trackable.rb', line 5 def self.included(base) base.class_eval do has_many :tracking_events, :class_name => 'IfdTools::Tracking::Event', foreign_key: :trackable_id, dependent: :destroy end end |
Instance Method Details
#trackable_activity ⇒ Object
24 25 26 |
# File 'lib/ifd_tools/analytics/trackable.rb', line 24 def trackable_activity tracking_events.count end |
#trackable_resource ⇒ Object
Override if you might want to link to something else
20 21 22 |
# File 'lib/ifd_tools/analytics/trackable.rb', line 20 def trackable_resource self end |
#trackable_title ⇒ Object
11 12 13 |
# File 'lib/ifd_tools/analytics/trackable.rb', line 11 def trackable_title name rescue title end |
#trackable_type ⇒ Object
15 16 17 |
# File 'lib/ifd_tools/analytics/trackable.rb', line 15 def trackable_type self.class.name.titleize end |