From 65045f8871ad032d7a1b6a7cb453332920888fc1 Mon Sep 17 00:00:00 2001 From: Kat <54268893+kosiakkatrina@users.noreply.github.com> Date: Fri, 6 Dec 2024 16:57:17 +0000 Subject: [PATCH] Remove enum deprecation warnings --- app/models/bulk_upload.rb | 6 +++--- app/models/csv_download.rb | 2 +- app/models/location.rb | 6 +++--- app/models/log.rb | 6 +++--- app/models/merge_request.rb | 2 +- app/models/organisation.rb | 2 +- app/models/scheme.rb | 18 +++++++++--------- app/models/user.rb | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/app/models/bulk_upload.rb b/app/models/bulk_upload.rb index a0ed265c9..2e0232dfe 100644 --- a/app/models/bulk_upload.rb +++ b/app/models/bulk_upload.rb @@ -1,7 +1,7 @@ class BulkUpload < ApplicationRecord - enum log_type: { lettings: "lettings", sales: "sales" } - enum rent_type_fix_status: { not_applied: "not_applied", applied: "applied", not_needed: "not_needed" } - enum failure_reason: { blank_template: "blank_template", wrong_template: "wrong_template" } + enum :log_type, { lettings: "lettings", sales: "sales" } + enum :rent_type_fix_status, { not_applied: "not_applied", applied: "applied", not_needed: "not_needed" } + enum :failure_reason, { blank_template: "blank_template", wrong_template: "wrong_template" } belongs_to :user diff --git a/app/models/csv_download.rb b/app/models/csv_download.rb index 4064c62f3..5623f4a43 100644 --- a/app/models/csv_download.rb +++ b/app/models/csv_download.rb @@ -1,5 +1,5 @@ class CsvDownload < ApplicationRecord - enum download_type: { lettings: "lettings", sales: "sales", schemes: "schemes", locations: "locations", combined: "combined" } + enum :download_type, { lettings: "lettings", sales: "sales", schemes: "schemes", locations: "locations", combined: "combined" } belongs_to :user belongs_to :organisation diff --git a/app/models/location.rb b/app/models/location.rb index 048f88fb0..0f5616c16 100644 --- a/app/models/location.rb +++ b/app/models/location.rb @@ -172,7 +172,7 @@ class Location < ApplicationRecord LOCAL_AUTHORITIES = LocalAuthority.all.map { |la| [la.name, la.code] }.to_h attribute :local_authorities, :string - enum local_authorities: LOCAL_AUTHORITIES + enum :local_authorities, LOCAL_AUTHORITIES def self.local_authorities_for_current_year LocalAuthority.all.active(Time.zone.today).england.map { |la| [la.code, la.name] }.to_h end @@ -185,7 +185,7 @@ class Location < ApplicationRecord "Missing": "X", }.freeze - enum mobility_type: MOBILITY_TYPE + enum :mobility_type, MOBILITY_TYPE TYPE_OF_UNIT = { "Bungalow": 6, @@ -196,7 +196,7 @@ class Location < ApplicationRecord "Shared house or hostel": 4, }.freeze - enum type_of_unit: TYPE_OF_UNIT + enum :type_of_unit, TYPE_OF_UNIT def self.find_by_id_on_multiple_fields(id) return if id.nil? diff --git a/app/models/log.rb b/app/models/log.rb index 73650d233..e0d6f24f2 100644 --- a/app/models/log.rb +++ b/app/models/log.rb @@ -18,14 +18,14 @@ class Log < ApplicationRecord "pending" => 3, "deleted" => 4, }.freeze - enum status: STATUS - enum status_cache: STATUS, _prefix: true + enum :status, STATUS + enum :status_cache, STATUS, _prefix: true CREATION_METHOD = { "single log" => 1, "bulk upload" => 2, }.freeze - enum creation_method: CREATION_METHOD, _prefix: true + enum :creation_method, CREATION_METHOD, _prefix: true scope :visible, -> { where(status: %w[not_started in_progress completed]) } scope :exportable, -> { where(status: %w[not_started in_progress completed deleted]) } diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index ead256d75..47ffc84dc 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -15,7 +15,7 @@ class MergeRequest < ApplicationRecord }.freeze attribute :status, :string - enum status: STATUS + enum :status, STATUS scope :not_merged, -> { where(request_merged: [false, nil]) } scope :merged, -> { where(request_merged: true) } diff --git a/app/models/organisation.rb b/app/models/organisation.rb index 69c80d198..c3d0a8ca0 100644 --- a/app/models/organisation.rb +++ b/app/models/organisation.rb @@ -53,7 +53,7 @@ class Organisation < ApplicationRecord PRP: 2, }.freeze - enum provider_type: PROVIDER_TYPE + enum :provider_type, PROVIDER_TYPE alias_method :la?, :LA? diff --git a/app/models/scheme.rb b/app/models/scheme.rb index a9b479342..97f188c99 100644 --- a/app/models/scheme.rb +++ b/app/models/scheme.rb @@ -145,7 +145,7 @@ class Scheme < ApplicationRecord Yes: 1, }.freeze - enum sensitive: SENSITIVE, _suffix: true + enum :sensitive, SENSITIVE, _suffix: true REGISTERED_UNDER_CARE_ACT = { "Yes – registered care home providing nursing care": 4, @@ -154,7 +154,7 @@ class Scheme < ApplicationRecord "No": 1, }.freeze - enum registered_under_care_act: REGISTERED_UNDER_CARE_ACT + enum :registered_under_care_act, REGISTERED_UNDER_CARE_ACT SCHEME_TYPE = { "Direct Access Hostel": 5, @@ -164,7 +164,7 @@ class Scheme < ApplicationRecord "Missing": 0, }.freeze - enum scheme_type: SCHEME_TYPE, _suffix: true + enum :scheme_type, SCHEME_TYPE, _suffix: true SUPPORT_TYPE = { "Missing": 0, @@ -175,7 +175,7 @@ class Scheme < ApplicationRecord "Floating support": 6, }.freeze - enum support_type: SUPPORT_TYPE, _suffix: true + enum :support_type, SUPPORT_TYPE, _suffix: true PRIMARY_CLIENT_GROUP = { "Homeless families with support needs": "O", @@ -197,8 +197,8 @@ class Scheme < ApplicationRecord "Missing": "X", }.freeze - enum primary_client_group: PRIMARY_CLIENT_GROUP, _suffix: true - enum secondary_client_group: PRIMARY_CLIENT_GROUP, _suffix: true + enum :primary_client_group, PRIMARY_CLIENT_GROUP, _suffix: true + enum :secondary_client_group, PRIMARY_CLIENT_GROUP, _suffix: true INTENDED_STAY = { "Very short stay": "V", @@ -213,8 +213,8 @@ class Scheme < ApplicationRecord Yes: 1, }.freeze - enum intended_stay: INTENDED_STAY, _suffix: true - enum has_other_client_group: HAS_OTHER_CLIENT_GROUP, _suffix: true + enum :intended_stay, INTENDED_STAY, _suffix: true + enum :has_other_client_group, HAS_OTHER_CLIENT_GROUP, _suffix: true ARRANGEMENT_TYPE = { "The same organisation that owns the housing stock": "D", @@ -226,7 +226,7 @@ class Scheme < ApplicationRecord DUPLICATE_SCHEME_ATTRIBUTES = %w[scheme_type registered_under_care_act primary_client_group secondary_client_group has_other_client_group support_type intended_stay].freeze - enum arrangement_type: ARRANGEMENT_TYPE, _suffix: true + enum :arrangement_type, ARRANGEMENT_TYPE, _suffix: true def self.find_by_id_on_multiple_fields(scheme_id, location_id) return if scheme_id.nil? diff --git a/app/models/user.rb b/app/models/user.rb index 3d6dbe893..823e78b2b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -56,7 +56,7 @@ class User < ApplicationRecord unassign: "No, unassign the logs", }.freeze - enum role: ROLES + enum :role, ROLES scope :search_by_name, ->(name) { where("users.name ILIKE ?", "%#{name}%") } scope :search_by_email, ->(email) { where("email ILIKE ?", "%#{email}%") }