Module: ActsAsTrackable

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/acts_as_trackable.rb

Overview

Just works with effective_resources controller to track views on show action Add acts_as_trackable to your model add_column :things, :tracks_count, :integer, default: 0

Defined Under Namespace

Modules: Base, ClassMethods

Instance Method Summary collapse

Instance Method Details

#track!(action: 'view', user: nil, details: nil) ⇒ Object

Instance Methods



25
26
27
# File 'app/models/concerns/acts_as_trackable.rb', line 25

def track!(action: 'view', user: nil, details: nil)
  tracks.create!(action: action, user: user, details: details)
end