clarion/app/models/concerns/proposable.rb

16 lines
364 B
Ruby

module Proposable
extend ActiveSupport::Concern
def proposer
proposition.proposer
end
included do
has_one :proposition, as: :proposable
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