diff --git a/activemodel/lib/active_model/validations/validates.rb b/activemodel/lib/active_model/validations/validates.rb index 475251aee11aab69c67773bc065945238b317331..88cca318efe407ea51d83a703422eebc3031a363 100644 --- a/activemodel/lib/active_model/validations/validates.rb +++ b/activemodel/lib/active_model/validations/validates.rb @@ -63,7 +63,7 @@ module ClassMethods # and strings in shortcut form. # # validates :email, format: /@/ - # validates :subscribed_to_newsletter, inclusion: [true, false] + # validates :role, inclusion: %(admin contributor) # validates :password, length: 6..20 # # When using shortcut form, ranges and arrays are passed to your diff --git a/guides/source/i18n.md b/guides/source/i18n.md index f1b61287628b2634538e09265f6fcaac17d42e12..f42ab15b8b81a514f09efdc93f2ad157a21041d3 100644 --- a/guides/source/i18n.md +++ b/guides/source/i18n.md @@ -857,12 +857,12 @@ In the event you need to access nested attributes within a given model, you shou en: activerecord: attributes: - user/subscribed_to_newsletter: - true: "True" - false: "False" + user/role: + admin: "Admin" + contributor: "Contributor" ``` -Then `User.human_attribute_name("subscribed_to_newsletter.true")` will return "True". +Then `User.human_attribute_name("role.admin")` will return "Admin". NOTE: If you are using a class which includes `ActiveModel` and does not inherit from `ActiveRecord::Base`, replace `activerecord` with `activemodel` in the above key paths.