8508d64a92
The Proposable concern defines a relation to a Proposition and defines scopes that translate to the statuses of the Proposition.
12 lines
317 B
Ruby
12 lines
317 B
Ruby
module Proposable
|
|
extend ActiveSupport::Concern
|
|
|
|
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
|