Module: PublicActivity::Tracked
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/public_activity/roles/tracked.rb
Overview
Main module extending classes we want to keep track of.
Instance Method Summary collapse
-
#activity(options = {}) ⇒ nil
A shortcut method for setting custom key, owner and parameters of Activity in one line.
Instance Method Details
#activity(options = {}) ⇒ nil
A shortcut method for setting custom key, owner and parameters of Activity in one line. Accepts a hash with 3 keys: :key, :owner, :params. You can specify all of them or just the ones you want to overwrite.
Options
- :key
- :owner
- :params
- :recipient
-
Set the recipient for this activity. Useful for private notifications, which should only be visible to a certain user. See Common#activity_recipient.
32 33 34 35 36 37 38 39 40 |
# File 'lib/public_activity/roles/tracked.rb', line 32 def activity( = {}) rest = .clone self.activity_key = rest.delete(:key) if rest[:key] self.activity_owner = rest.delete(:owner) if rest[:owner] self.activity_params = rest.delete(:params) if rest[:params] self.activity_recipient = rest.delete(:recipient) if rest[:recipient] self.activity_custom_fields = rest if rest.count > 0 nil end |