Sha256: 1d24b160a936be425e89024abeabe3981a36a6462f5242ddc271948fd2d96cb9

Contents?: true

Size: 642 Bytes

Versions: 6

Compression:

Stored size: 642 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Elections
    # The data store for a Vote in the Decidim::Election component. It stores the hash computed from the `encrypted_vote` associated to a particular `voter_id`.
    class Vote < ApplicationRecord
      enum status: [:pending, :accepted, :rejected].map { |status| [status, status.to_s] }.to_h

      belongs_to :election, foreign_key: "decidim_elections_election_id", class_name: "Decidim::Elections::Election"
      belongs_to :user, foreign_key: "decidim_user_id", class_name: "Decidim::User"

      validates :voter_id, :encrypted_vote_hash, presence: true
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-elections-0.24.3 app/models/decidim/elections/vote.rb
decidim-elections-0.24.2 app/models/decidim/elections/vote.rb
decidim-elections-0.24.1 app/models/decidim/elections/vote.rb
decidim-elections-0.24.0 app/models/decidim/elections/vote.rb
decidim-elections-0.24.0.rc2 app/models/decidim/elections/vote.rb
decidim-elections-0.24.0.rc1 app/models/decidim/elections/vote.rb