Class: Comment

Inherits:
ApplicationRecord show all
Includes:
Concerns::Locale, Concerns::Parentable, Concerns::Spammable
Defined in:
app/models/comment.rb

Constant Summary collapse

STATUSES =
%w(pending_moderation published)

Instance Method Summary collapse

Methods included from Concerns::Spammable

#mark_as_spam!, #unmark_as_spam!

Methods included from Concerns::Parentable

#depth, #parentable?, #parents

Instance Method Details

#publish!Object



21
22
23
# File 'app/models/comment.rb', line 21

def publish!
  update_attribute :status, :published
end

#published?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'app/models/comment.rb', line 17

def published?
  status.to_s == 'published'
end

#unpublish!Object



25
26
27
# File 'app/models/comment.rb', line 25

def unpublish!
  update_attribute :status, :pending_moderation
end