11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/commontator/acts_as_commontator.rb', line 11
def acts_as_commontator(options = {})
class_exec do
association_options = options.(:dependent)
association_options[:dependent] ||= :destroy
cattr_accessor :commontator_config
self.commontator_config = Commontator::CommontatorConfig.new(options)
has_many :commontator_comments, **association_options.merge(
as: :creator, class_name: 'Commontator::Comment'
)
has_many :commontator_subscriptions, **association_options.merge(
as: :subscriber, class_name: 'Commontator::Subscription'
)
self.is_commontator = true
end
end
|