Add types to Poll Shifts as an enum
This commit is contained in:
@@ -7,6 +7,9 @@ class Poll
|
||||
validates :officer_id, presence: true
|
||||
validates :date, presence: true
|
||||
validates :date, uniqueness: { scope: [:officer_id, :booth_id] }
|
||||
validates :task, presence: true
|
||||
|
||||
enum task: { vote_collection: 0, recount_scrutiny: 1 }
|
||||
|
||||
before_create :persist_data
|
||||
after_create :create_officer_assignments
|
||||
|
||||
5
db/migrate/20170927110953_add_shift_task.rb
Normal file
5
db/migrate/20170927110953_add_shift_task.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class AddShiftTask < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :poll_shifts, :task, :integer, null: false, default: 0
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20170918231410) do
|
||||
ActiveRecord::Schema.define(version: 20170927110953) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -687,6 +687,7 @@ ActiveRecord::Schema.define(version: 20170918231410) do
|
||||
t.datetime "updated_at"
|
||||
t.string "officer_name"
|
||||
t.string "officer_email"
|
||||
t.integer "task", default: 0, null: false
|
||||
end
|
||||
|
||||
add_index "poll_shifts", ["booth_id", "officer_id"], name: "index_poll_shifts_on_booth_id_and_officer_id", using: :btree
|
||||
|
||||
Reference in New Issue
Block a user