Class: Comment

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/generators/templates/model.rb

Class Method Summary collapse

Class Method Details

.comments_by(commenter) ⇒ Object



6
7
8
# File 'lib/generators/templates/model.rb', line 6

def comments_by(commenter)
  where(["commenter_id = ? AND commenter_type = ?", commenter.id, commenter.class.name])
end

.comments_on(commentable) ⇒ Object



10
11
12
# File 'lib/generators/templates/model.rb', line 10

def comments_on(commentable)
  where(["commentable_id = ? AND commentable_type = ?", commentable.id, commentable.class.name])
end