From 40cfbae94adf67f229a887358740aa65351012dc Mon Sep 17 00:00:00 2001 From: Daniel Amireh Date: Wed, 25 Jul 2018 18:03:14 +0200 Subject: Update with_options.rb explicit mapping for enum accepts a Hash not an Array, plus the example is using `.keys` which also exists on hash --- activesupport/lib/active_support/core_ext/object/with_options.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') 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 2838fd76be..1d46add6e0 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 } -- cgit v1.2.3