Sha256: ec678eaf8e6e901127f6e7af4af7837acbabf386b6424ea2433411d456a78f38

Contents?: true

Size: 754 Bytes

Versions: 7

Compression:

Stored size: 754 Bytes

Contents

module ErpForms
  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

7 entries across 7 versions & 1 rubygems

Version Path
erp_forms-3.1.2 lib/erp_forms/extensions/active_record/acts_as_commentable.rb
erp_forms-3.1.1 lib/erp_forms/extensions/active_record/acts_as_commentable.rb
erp_forms-3.1.0 lib/erp_forms/extensions/active_record/acts_as_commentable.rb
erp_forms-3.0.2 lib/erp_forms/extensions/active_record/acts_as_commentable.rb
erp_forms-3.0.1 lib/erp_forms/extensions/active_record/acts_as_commentable.rb
erp_forms-3.0.0 lib/erp_forms/extensions/active_record/acts_as_commentable.rb
erp_forms-2.1.0 lib/erp_forms/extensions/active_record/acts_as_commentable.rb