Use Rails 5 conventions in ballot migrations

These migrations and models were added after the Rails 5 branch was
created but before it was merged.
This commit is contained in:
Javi Martín
2019-04-24 19:22:39 +02:00
parent b230cd29ab
commit 4b1cbb7db6
7 changed files with 7 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
class Poll::Ballot < ActiveRecord::Base class Poll::Ballot < ApplicationRecord
belongs_to :ballot_sheet, class_name: Poll::BallotSheet belongs_to :ballot_sheet, class_name: Poll::BallotSheet
validates :ballot_sheet_id, presence: true validates :ballot_sheet_id, presence: true

View File

@@ -1,4 +1,4 @@
class Poll::BallotSheet < ActiveRecord::Base class Poll::BallotSheet < ApplicationRecord
belongs_to :poll belongs_to :poll
belongs_to :officer_assignment belongs_to :officer_assignment
has_many :ballots, class_name: Poll::Ballot has_many :ballots, class_name: Poll::Ballot

View File

@@ -1,4 +1,4 @@
class AddBallotedHeadingIdToUsers < ActiveRecord::Migration class AddBallotedHeadingIdToUsers < ActiveRecord::Migration[4.2]
def change def change
add_column :users, :balloted_heading_id, :integer, default: nil add_column :users, :balloted_heading_id, :integer, default: nil
end end

View File

@@ -1,4 +1,4 @@
class AddBudgetToPolls < ActiveRecord::Migration class AddBudgetToPolls < ActiveRecord::Migration[4.2]
def change def change
add_reference :polls, :budget, index: { unique: true }, foreign_key: true add_reference :polls, :budget, index: { unique: true }, foreign_key: true
end end

View File

@@ -1,4 +1,4 @@
class CreatePollBallotSheets < ActiveRecord::Migration class CreatePollBallotSheets < ActiveRecord::Migration[4.2]
def change def change
create_table :poll_ballot_sheets do |t| create_table :poll_ballot_sheets do |t|
t.text :data t.text :data

View File

@@ -1,4 +1,4 @@
class CreatePollBallot < ActiveRecord::Migration class CreatePollBallot < ActiveRecord::Migration[4.2]
def change def change
create_table :poll_ballots do |t| create_table :poll_ballots do |t|
t.integer :ballot_sheet_id t.integer :ballot_sheet_id

View File

@@ -1,4 +1,4 @@
class AddPhysicalToBudgetBallot < ActiveRecord::Migration class AddPhysicalToBudgetBallot < ActiveRecord::Migration[4.2]
def change def change
add_column :budget_ballots, :physical, :boolean, default: false add_column :budget_ballots, :physical, :boolean, default: false
add_column :budget_ballots, :poll_ballot_id, :integer add_column :budget_ballots, :poll_ballot_id, :integer