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
14 lines
287 B
Ruby
14 lines
287 B
Ruby
class SDG::Phase < ApplicationRecord
|
|
include Cardable
|
|
enum :kind, %w[sensitization planning monitoring]
|
|
validates :kind, presence: true, uniqueness: true
|
|
|
|
def self.[](kind)
|
|
find_by!(kind: kind)
|
|
end
|
|
|
|
def title
|
|
self.class.human_attribute_name("kind.#{kind}")
|
|
end
|
|
end
|