Module: Model::Comment

Extended by:
ActiveSupport::Concern
Included in:
Interact::Comment
Defined in:
app/models/interact/model/comment.rb

Instance Method Summary collapse

Instance Method Details

#compute_scoreObject



38
39
40
# File 'app/models/interact/model/comment.rb', line 38

def compute_score
  self.score = self.star_count.to_i * 2
end

#sync_commentableObject



31
32
33
34
35
36
# File 'app/models/interact/model/comment.rb', line 31

def sync_commentable
  if parent
    self.commentable_type = parent.commentable_type
    self.commentable_id = parent.commentable_id
  end
end

#sync_to_notificationObject



42
43
44
45
46
47
48
49
# File 'app/models/interact/model/comment.rb', line 42

def sync_to_notification
  to_notification(
    receiver: self.commentable.user,
    sender: self.user,
    linked: self.commentable,
    verbose: true
  )
end