Skip to content

Commit 05760be

Browse files
committed
Fix radio docs: use .label and pluck example
Use plan.label instead of .value.humanize, and show a realistic Plan.pluck(:id, :name) example for radio options.
1 parent 74aa973 commit 05760be

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,15 +417,15 @@ class SignupForm < Components::Form
417417
end
418418
end
419419

420-
# Radio groups: pass options to radio and iterate. Superform handles
421-
# the name, value, and checked state automatically.
420+
# Radio groups: pass [value, label] options and iterate. Superform
421+
# handles the name, value, and checked state automatically.
422422
fieldset do
423-
legend { "Status" }
424-
Field(:status).radio(User.statuses).each do |status|
423+
legend { "Plan" }
424+
Field(:plan_id).radio(*Plan.pluck(:id, :name)).each do |plan|
425425
label do
426-
status.radio
426+
plan.radio
427427
whitespace
428-
plain status.value.humanize
428+
plain plan.label
429429
end
430430
end
431431
end

0 commit comments

Comments
 (0)