Add an apply Rails/EnumSyntax rubocop rule
This rule was added in rubocop-rails 2.26.0. Applying it allows us to anticipate the deprecation of the current enum syntax using keyword arguments, which is set to be removed in Rails 8.0, as mentioned in the rule's own documentation: https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsenumsyntax
This commit is contained in:
@@ -388,6 +388,9 @@ Rails/DynamicFindBy:
|
|||||||
- find_by_slug_or_id!
|
- find_by_slug_or_id!
|
||||||
- find_by_manager_login
|
- find_by_manager_login
|
||||||
|
|
||||||
|
Rails/EnumSyntax:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
Rails/EnumUniqueness:
|
Rails/EnumUniqueness:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class Dashboard::Action < ApplicationRecord
|
|||||||
class_name: "Dashboard::ExecutedAction"
|
class_name: "Dashboard::ExecutedAction"
|
||||||
has_many :proposals, through: :executed_actions
|
has_many :proposals, through: :executed_actions
|
||||||
|
|
||||||
enum action_type: [:proposed_action, :resource]
|
enum :action_type, [:proposed_action, :resource]
|
||||||
|
|
||||||
validates :title, presence: true, allow_blank: false, length: { in: 4..80 }
|
validates :title, presence: true, allow_blank: false, length: { in: 4..80 }
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class Poll
|
|||||||
validates :date, presence: true, uniqueness: { scope: [:officer_id, :booth_id, :task] }
|
validates :date, presence: true, uniqueness: { scope: [:officer_id, :booth_id, :task] }
|
||||||
validates :task, presence: true
|
validates :task, presence: true
|
||||||
|
|
||||||
enum task: { vote_collection: 0, recount_scrutiny: 1 }
|
enum :task, { vote_collection: 0, recount_scrutiny: 1 }
|
||||||
|
|
||||||
scope :current, -> { where(date: Date.current) }
|
scope :current, -> { where(date: Date.current) }
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class ProgressBar < ApplicationRecord
|
|||||||
self.inheritance_column = nil
|
self.inheritance_column = nil
|
||||||
RANGE = (0..100)
|
RANGE = (0..100)
|
||||||
|
|
||||||
enum kind: %i[primary secondary]
|
enum :kind, %i[primary secondary]
|
||||||
|
|
||||||
belongs_to :progressable, polymorphic: true
|
belongs_to :progressable, polymorphic: true
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class SDG::Phase < ApplicationRecord
|
class SDG::Phase < ApplicationRecord
|
||||||
include Cardable
|
include Cardable
|
||||||
enum kind: %w[sensitization planning monitoring]
|
enum :kind, %w[sensitization planning monitoring]
|
||||||
validates :kind, presence: true, uniqueness: true
|
validates :kind, presence: true, uniqueness: true
|
||||||
|
|
||||||
def self.[](kind)
|
def self.[](kind)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class Tenant < ApplicationRecord
|
class Tenant < ApplicationRecord
|
||||||
enum schema_type: %w[subdomain domain]
|
enum :schema_type, %w[subdomain domain]
|
||||||
|
|
||||||
validates :schema,
|
validates :schema,
|
||||||
presence: true,
|
presence: true,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ class VotationType < ApplicationRecord
|
|||||||
|
|
||||||
QUESTIONABLE_TYPES = %w[Poll::Question].freeze
|
QUESTIONABLE_TYPES = %w[Poll::Question].freeze
|
||||||
|
|
||||||
enum vote_type: %w[unique multiple]
|
enum :vote_type, %w[unique multiple]
|
||||||
|
|
||||||
validates :questionable, presence: true
|
validates :questionable, presence: true
|
||||||
validates :questionable_type, inclusion: { in: ->(*) { QUESTIONABLE_TYPES }}
|
validates :questionable_type, inclusion: { in: ->(*) { QUESTIONABLE_TYPES }}
|
||||||
|
|||||||
Reference in New Issue
Block a user