Class: Tenon::Comment

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Humanizer
Defined in:
app/models/tenon/comment.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bypass_humanizerObject

Returns the value of attribute bypass_humanizer.



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

def bypass_humanizer
  @bypass_humanizer
end

#controllerObject

Returns the value of attribute controller.



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

def controller
  @controller
end

#subscribeObject

Returns the value of attribute subscribe.



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

def subscribe
  @subscribe
end

Class Method Details

.create_comment(object, session) ⇒ Object



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

def self.create_comment(object, session)
  session.blank? ? Comment.new(commentable_type: object.class.to_s, commentable_id: object.id) : Comment.new(session)
end

Instance Method Details

#approveObject



31
32
33
# File 'app/models/tenon/comment.rb', line 31

def approve
  self.approved = true
end

#toggle_approved!Object



26
27
28
29
# File 'app/models/tenon/comment.rb', line 26

def toggle_approved!
  self.approved = self.approved? ? false : true
  save
end