adds scopes for final/voting_days officer_assignments

This commit is contained in:
Juanjo Bazán
2017-01-30 11:51:19 +01:00
parent e85a227477
commit 2859975e81
2 changed files with 7 additions and 3 deletions

View File

@@ -10,5 +10,8 @@ class Poll
validates :date, presence: true, uniqueness: { scope: [:officer_id, :booth_assignment_id] }
delegate :poll_id, :booth_id, to: :booth_assignment
scope :voting_days, -> { where(final: false) }
scope :final, -> { where(final: true) }
end
end

View File

@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170130101121) do
ActiveRecord::Schema.define(version: 20170130103550) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -413,9 +413,10 @@ ActiveRecord::Schema.define(version: 20170130101121) do
create_table "poll_officer_assignments", force: :cascade do |t|
t.integer "booth_assignment_id"
t.integer "officer_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "date"
t.boolean "final", default: false
end
create_table "poll_officers", force: :cascade do |t|