removes poll_id from voter
YAGNI
This commit is contained in:
@@ -7,8 +7,6 @@ class Poll
|
|||||||
validate :in_census
|
validate :in_census
|
||||||
validate :has_not_voted
|
validate :has_not_voted
|
||||||
|
|
||||||
before_create :assign_poll
|
|
||||||
|
|
||||||
def in_census
|
def in_census
|
||||||
errors.add(:document_number, :not_in_census) unless census_api_response.valid?
|
errors.add(:document_number, :not_in_census) unless census_api_response.valid?
|
||||||
end
|
end
|
||||||
@@ -29,9 +27,5 @@ class Poll
|
|||||||
@census.name
|
@census.name
|
||||||
end
|
end
|
||||||
|
|
||||||
def assign_poll
|
|
||||||
poll_id = booth_assignment.poll_id
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
5
db/migrate/20161207181001_remove_poll_id_from_voter.rb
Normal file
5
db/migrate/20161207181001_remove_poll_id_from_voter.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
class RemovePollIdFromVoter < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
remove_column :poll_voters, :poll_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: 20161206132126) do
|
ActiveRecord::Schema.define(version: 20161207181001) 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"
|
||||||
@@ -340,7 +340,6 @@ ActiveRecord::Schema.define(version: 20161206132126) do
|
|||||||
t.string "document_number"
|
t.string "document_number"
|
||||||
t.string "document_type"
|
t.string "document_type"
|
||||||
t.integer "booth_assignment_id", null: false
|
t.integer "booth_assignment_id", null: false
|
||||||
t.integer "poll_id", null: false
|
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user