diff --git a/app/models/poll.rb b/app/models/poll.rb index 1bd3d07ef..482b0cf0f 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -1,5 +1,4 @@ class Poll < ActiveRecord::Base - has_many :booths has_many :voters, through: :booths, class_name: "Poll::Voter" has_many :officers, through: :booths, class_name: "Poll::Officer" has_many :questions diff --git a/app/models/poll/booth.rb b/app/models/poll/booth.rb index 74c4c3edb..ba9b1f47c 100644 --- a/app/models/poll/booth.rb +++ b/app/models/poll/booth.rb @@ -1,6 +1,5 @@ class Poll class Booth < ActiveRecord::Base - belongs_to :poll has_many :voters has_many :officing_booths, dependent: :destroy has_many :officers, through: :officing_booths diff --git a/db/migrate/20161130122604_remove_poll_id_from_booth.rb b/db/migrate/20161130122604_remove_poll_id_from_booth.rb new file mode 100644 index 000000000..a84b1a70a --- /dev/null +++ b/db/migrate/20161130122604_remove_poll_id_from_booth.rb @@ -0,0 +1,5 @@ +class RemovePollIdFromBooth < ActiveRecord::Migration + def change + remove_column :poll_booths, :poll_id, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index 4f7c23f63..78150e6e7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20161129011737) do +ActiveRecord::Schema.define(version: 20161130122604) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -279,9 +279,8 @@ ActiveRecord::Schema.define(version: 20161129011737) do add_index "organizations", ["user_id"], name: "index_organizations_on_user_id", using: :btree create_table "poll_booths", force: :cascade do |t| - t.string "name" - t.integer "poll_id" - t.string "location" + t.string "name" + t.string "location" end create_table "poll_officers", force: :cascade do |t|