Sha256: 62485134218eaf7a6a92cfd08544a9d7fca9a80108df26336efd397563c51b82
Contents?: true
Size: 998 Bytes
Versions: 12
Compression:
Stored size: 998 Bytes
Contents
require 'commontator/commontator_config' module Commontator module ActsAsCommontator def self.included(base) base.class_attribute :is_commontator base.is_commontator = false base.extend(ClassMethods) end module ClassMethods def acts_as_commontator(options = {}) class_eval do cattr_accessor :commontator_config self.commontator_config = Commontator::CommontatorConfig.new(options) self.is_commontator = true has_many :comments, :as => :commontator, :class_name => 'Commontator::Comment' has_many :subscriptions, :as => :subscriber, :class_name => 'Commontator::Subscription', :dependent => :destroy end end alias_method :acts_as_commonter, :acts_as_commontator alias_method :acts_as_commentator, :acts_as_commontator alias_method :acts_as_commenter, :acts_as_commontator end end end ActiveRecord::Base.send :include, Commontator::ActsAsCommontator
Version data entries
12 entries across 12 versions & 1 rubygems