Sha256: 8af5fa27050de6ec66c6f550d76414293936bf7794f1150383bc6f7b257d1ca7
Contents?: true
Size: 449 Bytes
Versions: 1
Compression:
Stored size: 449 Bytes
Contents
module CommentableOn module Commenter def self.included(base) base.class_eval do has_many :comments, class_name: "CommentableOn::Comment", as: :commenter, dependent: :nullify do def commentables includes(:commentable).map(&:commentable) end end end end def comment(commentable:, body:) commentable.add_comment args.merge(commenter: self, body: body) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
commentable_on-0.1.0 | lib/commentable_on/commenter.rb |