Files
fetsite/lib/is_commentable.rb
Andreas Stephanides 699517fb56 Revert "removecomments"
This reverts commit 6ee1468ce3.
2014-11-28 14:22:43 +01:00

21 lines
397 B
Ruby

module IsCommentable
def self.included(base)
base.class_eval do
include InstanceMethods
has_many :comments, as: :commentable, dependent: :destroy
# extend ClassMethods
end
end
module InstanceMethods
def is_commentable?
true
end
def comment(user, text, attr={})
comments << Comment.build_for(self, user, text, attr)
end
end
end