Class: Parrot::Comment
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Parrot::Comment
- Defined in:
- app/models/parrot/comment.rb
Class Method Summary collapse
Instance Method Summary collapse
- #author ⇒ Object
-
#cache_author_data ⇒ Object
An author may delete it’s account, we cache/store it’s sensitive data.
Class Method Details
.following(other_comment) ⇒ Object
21 22 23 |
# File 'app/models/parrot/comment.rb', line 21 def self.following(other_comment) siblings_of(other_comment).where("id > #{other_comment.id}") end |
.siblings_of(other_comment) ⇒ Object
14 15 16 17 18 19 |
# File 'app/models/parrot/comment.rb', line 14 def self.siblings_of(other_comment) where( commentable_type: other_comment.commentable_type, commentable_id: other_comment.commentable_id ) end |
Instance Method Details
#author ⇒ Object
25 26 27 |
# File 'app/models/parrot/comment.rb', line 25 def Parrot..find_by_id end |
#cache_author_data ⇒ Object
An author may delete it’s account, we cache/store it’s sensitive data
30 31 32 33 34 35 |
# File 'app/models/parrot/comment.rb', line 30 def return if .nil? [:name, :email, :phone].each do |method| self.send(:"author_#{method}=", .send(method)) if .respond_to?(method) end end |