Module: Timeliner
- Defined in:
- lib/timeliner.rb,
lib/timeliner/engine.rb,
lib/timeliner/version.rb,
app/models/timeliner/activity.rb,
lib/timeliner/tracking_concern.rb,
app/jobs/timeliner/application_job.rb,
app/jobs/timeliner/create_activity.rb,
app/models/timeliner/application_record.rb
Defined Under Namespace
Modules: TrackingConcern
Classes: Activity, ApplicationJob, ApplicationRecord, CreateActivity, Engine
Constant Summary
collapse
- VERSION =
"1.0.0"
Class Method Summary
collapse
Class Method Details
.engine ⇒ Object
5
6
7
|
# File 'lib/timeliner.rb', line 5
def self.engine
Engine
end
|
.find(trackable, key) ⇒ Object
13
14
15
16
17
|
# File 'lib/timeliner.rb', line 13
def self.find(trackable, key)
Activity
.where(trackable: trackable)
.where(key: key)
end
|
.last_activity(trackable) ⇒ Object
19
20
21
22
23
24
|
# File 'lib/timeliner.rb', line 19
def self.last_activity(trackable)
Activity
.where(trackable: trackable)
.order(created_at: :desc)
.limit(1)
end
|
.track(trackable, key, user = nil) ⇒ Object
9
10
11
|
# File 'lib/timeliner.rb', line 9
def self.track(trackable, key, user=nil)
CreateActivity.perform_later(trackable: trackable, key: key, user: user)
end
|