Class: BlogComment

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
ApplicationHelper
Defined in:
app/models/blog_comment.rb

Overview

@Name :BlogComment model

@Created at :12-06-2012
@Updated at  :12-06-2012
@Purpose :Needed for initailizing activerecord for blog_comments table in rails
@Company  :Mindfire Solutions

Defined Under Namespace

Modules: Moderation, Notification

Instance Method Summary collapse

Methods included from ApplicationHelper

#notify_me

Instance Method Details

#approve!Object

Set the approved state for the comment



33
34
35
# File 'app/models/blog_comment.rb', line 33

def approve!
  self.update_attribute(:state, 'approved')
end

#is_approved?Boolean

Findout whether the comment is approved or not

Returns:

  • (Boolean)


48
49
50
# File 'app/models/blog_comment.rb', line 48

def is_approved?
  self.state == 'approved'
end

#is_rejected?Boolean

Findout whether the comment is rejected or not

Returns:

  • (Boolean)


43
44
45
# File 'app/models/blog_comment.rb', line 43

def is_rejected?
  self.state == 'rejected'
end

#is_unmoderated?Boolean

Findout whether the comment is unmoderated or not

Returns:

  • (Boolean)


53
54
55
# File 'app/models/blog_comment.rb', line 53

def is_unmoderated?
  self.state.nil?
end

#reject!Object

Set the reject state for the comment



38
39
40
# File 'app/models/blog_comment.rb', line 38

def reject!
  self.update_attribute(:state, 'rejected')
end