Inclusive Language in Documentation Examples [ci skip]

This commit is contained in:
Cassidy Kobewka 2018-04-15 10:42:56 -04:00
parent d472229f1f
commit 2aa8e0a56f
No known key found for this signature in database
GPG Key ID: 256CDBF985F0BFBE
5 changed files with 16 additions and 16 deletions

View File

@ -389,8 +389,8 @@ module ActionView
# * Any other key creates standard HTML options for the tag.
#
# ==== Examples
# radio_button_tag 'gender', 'male'
# # => <input id="gender_male" name="gender" type="radio" value="male" />
# radio_button_tag 'favorite_color', 'maroon'
# # => <input id="favorite_color_maroon" name="favorite_color" type="radio" value="maroon" />
#
# radio_button_tag 'receive_updates', 'no', true
# # => <input checked="checked" id="receive_updates_no" name="receive_updates" type="radio" value="no" />

View File

@ -63,7 +63,7 @@ module ActiveModel
# and strings in shortcut form.
#
# validates :email, format: /@/
# validates :gender, inclusion: %w(male female)
# validates :subscribed_to_newsletter, inclusion: [true, false]
# validates :password, length: 6..20
#
# When using shortcut form, ranges and arrays are passed to your

View File

@ -163,10 +163,10 @@ class Module
# parent class. Similarly if parent class changes the value then that would
# change the value of subclasses too.
#
# class Male < Person
# class Citizen < Person
# end
#
# Male.new.hair_colors << :blue
# Citizen.new.hair_colors << :blue
# Person.new.hair_colors # => [:brown, :black, :blonde, :red, :blue]
#
# To opt out of the instance writer method, pass <tt>instance_writer: false</tt>.

View File

@ -1267,8 +1267,8 @@ password_field_tag 'pass'
Creates a radio button; use groups of radio buttons named the same to allow users to select from a group of options.
```ruby
radio_button_tag 'gender', 'male'
# => <input id="gender_male" name="gender" type="radio" value="male" />
radio_button_tag 'favorite_color', 'maroon'
# => <input id="favorite_color_maroon" name="favorite_color" type="radio" value="maroon" />
```
#### select_tag

View File

@ -829,14 +829,14 @@ For example when you add the following translations:
en:
activerecord:
models:
user: Dude
user: Customer
attributes:
user:
login: "Handle"
# will translate User attribute "login" as "Handle"
```
Then `User.model_name.human` will return "Dude" and `User.human_attribute_name("login")` will return "Handle".
Then `User.model_name.human` will return "Customer" and `User.human_attribute_name("login")` will return "Handle".
You can also set a plural form for model names, adding as following:
@ -845,11 +845,11 @@ en:
activerecord:
models:
user:
one: Dude
other: Dudes
one: Customer
other: Customers
```
Then `User.model_name.human(count: 2)` will return "Dudes". With `count: 1` or without params will return "Dude".
Then `User.model_name.human(count: 2)` will return "Customers". With `count: 1` or without params will return "Customer".
In the event you need to access nested attributes within a given model, you should nest these under `model/attribute` at the model level of your translation file:
@ -857,12 +857,12 @@ In the event you need to access nested attributes within a given model, you shou
en:
activerecord:
attributes:
user/gender:
female: "Female"
male: "Male"
user/subscribed_to_newsletter:
true: "True"
false: "False"
```
Then `User.human_attribute_name("gender.female")` will return "Female".
Then `User.human_attribute_name("subscribed_to_newsletter.true")` will return "True".
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.