class ActionTracker::Models::Payload
Constants
- MAX_CONTENT_LENGTH
Public Instance Methods
attributes()
click to toggle source
Calls superclass method
# File lib/action_tracker/models/payload.rb, line 38 def attributes super.merge(user: user.attributes) end
for_event(event)
click to toggle source
# File lib/action_tracker/models/payload.rb, line 28 def for_event(event) self[:event] = event.to_s.humanize self end
user()
click to toggle source
Calls superclass method
# File lib/action_tracker/models/payload.rb, line 24 def user super || ActionTracker::Models::User.default_user end
with_content(content)
click to toggle source
# File lib/action_tracker/models/payload.rb, line 33 def with_content(content) self[:content] = content.to_s.truncate(MAX_CONTENT_LENGTH) self end
with_user(user)
click to toggle source
# File lib/action_tracker/models/payload.rb, line 14 def with_user(user) self[:user] = ActionTracker::Models::User.new( id: user.try(:id), name: user.try(:name), type: user.try(:type) ) self end