6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/flexible_feeds/acts_as_eventable.rb', line 6
def acts_as_eventable(options = {})
has_one :event, as: :eventable, class_name: "FlexibleFeeds::Event",
dependent: :destroy
has_many :feeds, through: :event, class_name: "FlexibleFeeds::Feed"
after_save :post_to_default_feeds
send :include, InstanceMethods
cattr_accessor :default_feeds
self.default_feeds = options[:add_to_feeds] || :default_custom_feeds
if options[:is_parent] === true
acts_as_parent
elsif options[:is_parent].present?
acts_as_parent options[:is_parent]
end
if options[:is_child] === true
acts_as_child
elsif options[:is_child].present?
acts_as_child options[:is_child]
end
end
|