Class: Activities::CommentObserver
- Inherits:
-
Logger
- Object
- ActiveRecord::Observer
- Logger
- Activities::CommentObserver
show all
- Defined in:
- app/observers/activities/comment_observer.rb
Instance Method Summary
collapse
Methods inherited from Logger
#after_destroy, #after_save, #before_save, logs_activity
Instance Method Details
#collect_activity_attributes(record) ⇒ Object
13
14
15
16
17
18
|
# File 'app/observers/activities/comment_observer.rb', line 13
def collect_activity_attributes(record)
attrs = record.send(:clone_attributes)
attrs = attrs.slice 'commentable_id', 'body', 'author_name', 'author_email', 'author_url'
type = record..has_attribute?('type') ? record.['type'] : record.
attrs.update('commentable_type' => type, 'commentable_title' => record..title)
end
|
#initialize_activity(record) ⇒ Object
20
21
22
23
24
25
26
|
# File 'app/observers/activities/comment_observer.rb', line 20
def initialize_activity(record)
super.tap do |activity|
activity.site = record..site
activity.section = record..section
activity.author = record.author
end
end
|