Class: Commentui::Comment

Inherits:
ApplicationRecord show all
Defined in:
app/models/commentui/comment.rb

Instance Method Summary collapse

Instance Method Details

#as_json(_opts = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'app/models/commentui/comment.rb', line 15

def as_json(_opts={})
  {
    id: self.id,
    content: self.content,
    updated_at: self.updated_at,
    created_at: self.created_at,
    creator: creator,
    editor: editor,
  }
end

#can_modify?(edited_user) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'app/models/commentui/comment.rb', line 11

def can_modify?(edited_user)
  edited_user == self.creator
end