Sha256: 27d43e8b10a84c96d4db0708d34c85155f41c349e8209a6b8dae557fe7f260ce
Contents?: true
Size: 1.12 KB
Versions: 4
Compression:
Stored size: 1.12 KB
Contents
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 has_many :comments, :as => :commontator, :class_name => 'Commontator::Comment', :dependent => :destroy has_many :subscriptions, :as => :subscriber, :class_name => 'Commontator::Subscription', :dependent => :destroy cattr_accessor :commontator_config self.commontator_config = Commontator::CommontatorConfig.new(options) self.is_commontator = true end end alias_method :acts_as_commonter, :acts_as_commontator def acts_as_commonter(options = {}) acts_as_commontator(options) end def acts_as_commentator(options = {}) acts_as_commontator(options) end def acts_as_commenter(options = {}) acts_as_commontator(options) end end end end ActiveRecord::Base.send :include, Commontator::ActsAsCommontator
Version data entries
4 entries across 4 versions & 1 rubygems