removes poll-booth direct association

This commit is contained in:
Juanjo Bazán
2016-11-30 13:31:43 +01:00
parent ef52285121
commit 9583c052f0
4 changed files with 8 additions and 6 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,5 @@
class RemovePollIdFromBooth < ActiveRecord::Migration
def change
remove_column :poll_booths, :poll_id, :integer
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: 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|