Sha256: daea20a9151e367d16ab1cd900a2febfe0457583b2aebab627be8a0f80880228
Contents?: true
Size: 757 Bytes
Versions: 2
Compression:
Stored size: 757 Bytes
Contents
module Knitkit module Extensions module ActiveRecord module ActsAsCommentable def self.included(base) base.extend(ClassMethods) end module ClassMethods def acts_as_commentable has_many :comments, :as => :commented_record, :dependent => :destroy extend ActsAsCommentable::SingletonMethods include ActsAsCommentable::InstanceMethods end end module SingletonMethods end module InstanceMethods def add_comment(options={}) self.comments.create(options) end end end # ActsAsCommentable end # ActiveRecord end # Extensions end # Knitkit
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
knitkit-3.2.0 | lib/knitkit/extensions/active_record/acts_as_commentable.rb |
knitkit-3.0.0 | lib/knitkit/extensions/active_record/acts_as_commentable.rb |