Skip to content

Commit 8e6817f

Browse files
jonathanhefnerp8
andauthored
Merge pull request rails#43313 from eikes/patch-1
Improves ActionView FormHelper check_box documentation [ci-skip] Co-authored-by: Petrik <[email protected]>
2 parents 999c118 + 9b36864 commit 8e6817f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

actionview/lib/action_view/helpers/form_helper.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,6 +1257,12 @@ def text_area(object_name, method, options = {})
12571257
# Additional options on the input tag can be passed as a hash with +options+. The +checked_value+ defaults to 1
12581258
# while the default +unchecked_value+ is set to 0 which is convenient for boolean values.
12591259
#
1260+
# ==== Options
1261+
#
1262+
# * Any standard HTML attributes for the tag can be passed in, for example +:class+.
1263+
# * <tt>:checked</tt> - +true+ or +false+ forces the state of the checkbox to be checked or not.
1264+
# * <tt>:include_hidden</tt> - If set to false, the auxiliary hidden field described below will not be generated.
1265+
#
12601266
# ==== Gotcha
12611267
#
12621268
# The HTML specification says unchecked check boxes are not successful, and
@@ -1294,6 +1300,8 @@ def text_area(object_name, method, options = {})
12941300
# In that case it is preferable to either use +check_box_tag+ or to use
12951301
# hashes instead of arrays.
12961302
#
1303+
# ==== Examples
1304+
#
12971305
# # Let's say that @post.validated? is 1:
12981306
# check_box("post", "validated")
12991307
# # => <input name="post[validated]" type="hidden" value="0" />
@@ -2334,6 +2342,12 @@ def label(method, text = nil, options = {}, &block)
23342342
# Additional options on the input tag can be passed as a hash with +options+. The +checked_value+ defaults to 1
23352343
# while the default +unchecked_value+ is set to 0 which is convenient for boolean values.
23362344
#
2345+
# ==== Options
2346+
#
2347+
# * Any standard HTML attributes for the tag can be passed in, for example +:class+.
2348+
# * <tt>:checked</tt> - +true+ or +false+ forces the state of the checkbox to be checked or not.
2349+
# * <tt>:include_hidden</tt> - If set to false, the auxiliary hidden field described below will not be generated.
2350+
#
23372351
# ==== Gotcha
23382352
#
23392353
# The HTML specification says unchecked check boxes are not successful, and
@@ -2371,6 +2385,8 @@ def label(method, text = nil, options = {}, &block)
23712385
# In that case it is preferable to either use +check_box_tag+ or to use
23722386
# hashes instead of arrays.
23732387
#
2388+
# ==== Examples
2389+
#
23742390
# # Let's say that @post.validated? is 1:
23752391
# check_box("validated")
23762392
# # => <input name="post[validated]" type="hidden" value="0" />

0 commit comments

Comments
 (0)