clarion/app/models/concerns/proposable.rb
Petko Bordjukov 9ca34c5a22 Introduce a Participation model
This model is responsible for the 1..n - 1..n relationship between an
event and the people that will participate in it.
2015-07-31 14:40:04 +03:00

13 lines
362 B
Ruby

module Proposable
extend ActiveSupport::Concern
included do
has_one :proposition, as: :proposable
has_one :proposer, through: :proposition
Proposition.defined_enums["status"].keys.each do |status|
scope status.to_sym, -> { joins(:proposition).where(propositions: {status: Proposition.defined_enums["status"][status]}) }
end
end
end