Add Officer relationship to Poll Voter
This commit is contained in:
@@ -13,7 +13,8 @@ class Officing::VotersController < Officing::BaseController
|
|||||||
document_number: @user.document_number,
|
document_number: @user.document_number,
|
||||||
user: @user,
|
user: @user,
|
||||||
poll: @poll,
|
poll: @poll,
|
||||||
origin: "booth")
|
origin: "booth",
|
||||||
|
officer: current_user.poll_officer)
|
||||||
@voter.save!
|
@voter.save!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ class Poll
|
|||||||
belongs_to :geozone
|
belongs_to :geozone
|
||||||
belongs_to :booth_assignment
|
belongs_to :booth_assignment
|
||||||
belongs_to :officer_assignment
|
belongs_to :officer_assignment
|
||||||
|
belongs_to :officer
|
||||||
|
|
||||||
validates :poll_id, presence: true
|
validates :poll_id, presence: true
|
||||||
validates :user_id, presence: true
|
validates :user_id, presence: true
|
||||||
|
|||||||
5
db/migrate/20171003223152_add_officer_to_poll_voter.rb
Normal file
5
db/migrate/20171003223152_add_officer_to_poll_voter.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
class AddOfficerToPollVoter < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :poll_voters, :officer_id, :integer
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20171003212958) do
|
ActiveRecord::Schema.define(version: 20171003223152) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
@@ -752,6 +752,7 @@ ActiveRecord::Schema.define(version: 20171003212958) do
|
|||||||
t.integer "officer_assignment_id"
|
t.integer "officer_assignment_id"
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.string "origin"
|
t.string "origin"
|
||||||
|
t.integer "officer_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "poll_voters", ["booth_assignment_id"], name: "index_poll_voters_on_booth_assignment_id", using: :btree
|
add_index "poll_voters", ["booth_assignment_id"], name: "index_poll_voters_on_booth_assignment_id", using: :btree
|
||||||
|
|||||||
@@ -531,6 +531,7 @@ FactoryGirl.define do
|
|||||||
factory :poll_voter, class: 'Poll::Voter' do
|
factory :poll_voter, class: 'Poll::Voter' do
|
||||||
poll
|
poll
|
||||||
association :user, :level_two
|
association :user, :level_two
|
||||||
|
association :officer, factory: :poll_officer
|
||||||
origin "web"
|
origin "web"
|
||||||
|
|
||||||
trait :from_booth do
|
trait :from_booth do
|
||||||
|
|||||||
Reference in New Issue
Block a user