Sha256: 038deb6b035b5d936d481f0c710f242a99132196633a4d92521d94261897964d

Contents?: true

Size: 583 Bytes

Versions: 3

Compression:

Stored size: 583 Bytes

Contents

module Popolo
  # The number of votes for one option in a vote event.
  class Count
    include Mongoid::Document

    store_in Popolo.storage_options_per_class.fetch(:Count, Popolo.storage_options)

    # The number of votes for options.
    belongs_to :vote_event, class_name: 'Popolo::VoteEvent'

    # An option in a vote event.
    field :option, type: String
    # The number of votes for an option.
    field :value, type: Integer
    # A group of voters.
    field :group

    validates_presence_of :option, :value

    def to_s
      "#{option}: #{value}"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
popolo-0.1.1 app/models/popolo/count.rb
popolo-0.1.0 app/models/popolo/count.rb
popolo-0.0.3 app/models/popolo/count.rb