Sha256: aeb0e4f1f7a3d14b2f4c60252ea60b92feb525bbbd1e2526587b364b7a235481

Contents?: true

Size: 871 Bytes

Versions: 15

Compression:

Stored size: 871 Bytes

Contents

# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
module FatFreeCRM
  module CommentExtensions
    def self.included(base)
      base.extend(ClassMethods)
    end

    module ClassMethods
      def uses_comment_extensions
        unless included_modules.include?(InstanceMethods)
          include FatFreeCRM::CommentExtensions::InstanceMethods
        end
      end
    end

    module InstanceMethods
      def add_comment_by_user(comment_body, user)
        comments.create(comment: comment_body, user: user) if comment_body.present?
      end
    end
  end
end

ActiveRecord::Base.send(:include, FatFreeCRM::CommentExtensions)

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
fat_free_crm-0.14.2 lib/fat_free_crm/comment_extensions.rb
fat_free_crm-0.15.2 lib/fat_free_crm/comment_extensions.rb
fat_free_crm-0.16.4 lib/fat_free_crm/comment_extensions.rb
fat_free_crm-0.14.1 lib/fat_free_crm/comment_extensions.rb
fat_free_crm-0.15.1 lib/fat_free_crm/comment_extensions.rb
fat_free_crm-0.16.3 lib/fat_free_crm/comment_extensions.rb
fat_free_crm-0.16.2 lib/fat_free_crm/comment_extensions.rb
fat_free_crm-0.16.1 lib/fat_free_crm/comment_extensions.rb
fat_free_crm-0.16.0 lib/fat_free_crm/comment_extensions.rb
fat_free_crm-0.15.0 lib/fat_free_crm/comment_extensions.rb
fat_free_crm-0.15.0.beta.2 lib/fat_free_crm/comment_extensions.rb
fat_free_crm-0.15.0.beta lib/fat_free_crm/comment_extensions.rb
fat_free_crm-0.14.0 lib/fat_free_crm/comment_extensions.rb
reduced_fat_crm-0.15.0.beta lib/fat_free_crm/comment_extensions.rb
reduced_fat_crm-0.14.0 lib/fat_free_crm/comment_extensions.rb