Use Rails 5 conventions in migrations and models

We forgot to add these changes to pull requests which were in
development before we upgraded to Rails 5.

We're also moving the rubocop rules to the basic files, so we're
notified when we inherit from `ActiveRecord::Base`.
This commit is contained in:
Javi Martín
2019-06-19 03:04:00 +02:00
parent 79852716f2
commit 765d405df1
12 changed files with 20 additions and 20 deletions

View File

@@ -93,18 +93,9 @@ Performance/UnfreezeString:
Performance/UriDefaultParser: Performance/UriDefaultParser:
Enabled: true Enabled: true
Rails/ActionFilter:
Enabled: true
Rails/ActiveSupportAliases: Rails/ActiveSupportAliases:
Enabled: true Enabled: true
Rails/ApplicationJob:
Enabled: true
Rails/ApplicationRecord:
Enabled: true
Rails/Blank: Rails/Blank:
Enabled: true Enabled: true

View File

@@ -38,6 +38,15 @@ Lint/UselessAssignment:
Metrics/LineLength: Metrics/LineLength:
Max: 110 Max: 110
Rails/ActionFilter:
Enabled: true
Rails/ApplicationJob:
Enabled: true
Rails/ApplicationRecord:
Enabled: true
RSpec/NotToNot: RSpec/NotToNot:
Enabled: true Enabled: true

View File

@@ -1,4 +1,4 @@
class Budget::Investment::ChangeLog < ActiveRecord::Base class Budget::Investment::ChangeLog < ApplicationRecord
belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id", required: false belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id", required: false
validates :old_value, presence: true validates :old_value, presence: true

View File

@@ -1,4 +1,4 @@
class DownloadSetting < ActiveRecord::Base class DownloadSetting < ApplicationRecord
validates :name_model, presence: true validates :name_model, presence: true
validates :name_field, presence: true validates :name_field, presence: true

View File

@@ -1,4 +1,4 @@
class CreateDownloadSettings < ActiveRecord::Migration class CreateDownloadSettings < ActiveRecord::Migration[4.2]
def change def change
create_table :download_settings do |t| create_table :download_settings do |t|
t.string :name_model, null: false t.string :name_model, null: false

View File

@@ -1,4 +1,4 @@
class AddConfigToDownloadSettings < ActiveRecord::Migration class AddConfigToDownloadSettings < ActiveRecord::Migration[4.2]
def change def change
add_column :download_settings, :config, :integer, default: 0, null: false add_column :download_settings, :config, :integer, default: 0, null: false

View File

@@ -1,4 +1,4 @@
class AddActionsToValuators < ActiveRecord::Migration class AddActionsToValuators < ActiveRecord::Migration[4.2]
def change def change
add_column :valuators, :can_comment, :boolean, default: true add_column :valuators, :can_comment, :boolean, default: true
add_column :valuators, :can_edit_dossier, :boolean, default: true add_column :valuators, :can_edit_dossier, :boolean, default: true

View File

@@ -1,4 +1,4 @@
class CreateBudgetInvestmentChangeLogs < ActiveRecord::Migration class CreateBudgetInvestmentChangeLogs < ActiveRecord::Migration[4.2]
def change def change
create_table :budget_investment_change_logs do |t| create_table :budget_investment_change_logs do |t|
t.integer :investment_id t.integer :investment_id

View File

@@ -1,4 +1,4 @@
class AddDateOfBirthToSignatures < ActiveRecord::Migration class AddDateOfBirthToSignatures < ActiveRecord::Migration[4.2]
def change def change
add_column :signatures, :date_of_birth, :date add_column :signatures, :date_of_birth, :date
end end

View File

@@ -1,4 +1,4 @@
class RenameDocumentNumbersToRequiredFieldsToVerifyInSignatureSheets < ActiveRecord::Migration class RenameDocumentNumbersToRequiredFieldsToVerifyInSignatureSheets < ActiveRecord::Migration[4.2]
def change def change
rename_column :signature_sheets, :document_numbers, :required_fields_to_verify rename_column :signature_sheets, :document_numbers, :required_fields_to_verify
end end

View File

@@ -1,4 +1,4 @@
class AddPostalCodeToSignatures < ActiveRecord::Migration class AddPostalCodeToSignatures < ActiveRecord::Migration[4.2]
def change def change
add_column :signatures, :postal_code, :string add_column :signatures, :postal_code, :string
end end

View File

@@ -1460,10 +1460,10 @@ ActiveRecord::Schema.define(version: 20190607160900) do
end end
create_table "signature_sheets", force: :cascade do |t| create_table "signature_sheets", force: :cascade do |t|
t.integer "signable_id"
t.string "signable_type" t.string "signable_type"
t.boolean "processed", default: false t.integer "signable_id"
t.text "required_fields_to_verify" t.text "required_fields_to_verify"
t.boolean "processed", default: false
t.integer "author_id" t.integer "author_id"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"