2015-04-20 18:35:22 +03:00
|
|
|
module Proposable
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
included do
|
|
|
|
has_one :proposition, as: :proposable
|
2015-07-29 17:54:41 +03:00
|
|
|
has_one :proposer, through: :proposition
|
2015-04-20 18:35:22 +03:00
|
|
|
|
|
|
|
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
|