Sha256: e82d6fa8dd25aaf12ee64d222fcc206dbd744c2ec29acd58c5eb107b691d4eca
Contents?: true
Size: 398 Bytes
Versions: 2
Compression:
Stored size: 398 Bytes
Contents
module Popolo module Eventable extend ActiveSupport::Concern included do embeds_many :sources, as: :sourceable, class_name: 'Popolo::Source' end # @note It's not possible to do a many-to-many polymorphic relation, so # we must create the relation manually. def events Event.where("related.#{self.class.name.demodulize.underscore}" => id) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
popolo-0.0.2 | lib/popolo/mixins/eventable.rb |
popolo-0.0.1 | lib/popolo/mixins/eventable.rb |