From ad2354e6c6fc12134c240b7af16169624f365f87 Mon Sep 17 00:00:00 2001 From: Jonathan Hefner Date: Mon, 1 Jan 2024 21:29:58 -0600 Subject: [PATCH] Switch to new enum syntax in example code [ci-skip] --- .../lib/active_record/attribute_methods/before_type_cast.rb | 2 +- .../lib/active_support/core_ext/object/with_options.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/attribute_methods/before_type_cast.rb b/activerecord/lib/active_record/attribute_methods/before_type_cast.rb index e4d562ad62..3284149350 100644 --- a/activerecord/lib/active_record/attribute_methods/before_type_cast.rb +++ b/activerecord/lib/active_record/attribute_methods/before_type_cast.rb @@ -56,7 +56,7 @@ def read_attribute_before_type_cast(attr_name) # serialization. # # class Book < ActiveRecord::Base - # enum status: { draft: 1, published: 2 } + # enum :status, { draft: 1, published: 2 } # end # # book = Book.new(status: "published") diff --git a/activesupport/lib/active_support/core_ext/object/with_options.rb b/activesupport/lib/active_support/core_ext/object/with_options.rb index 3225bab4ca..932aec221b 100644 --- a/activesupport/lib/active_support/core_ext/object/with_options.rb +++ b/activesupport/lib/active_support/core_ext/object/with_options.rb @@ -68,7 +68,7 @@ class Object # You can access these methods using the class name instead: # # class Phone < ActiveRecord::Base - # enum phone_number_type: { home: 0, office: 1, mobile: 2 } + # enum :phone_number_type, { home: 0, office: 1, mobile: 2 } # # with_options presence: true do # validates :phone_number_type, inclusion: { in: Phone.phone_number_types.keys }