From 91639e3029c7b446ea3033bf32a35a7266e48bd7 Mon Sep 17 00:00:00 2001 From: Filip Lindqvist Date: Sat, 12 Jul 2014 10:41:36 +0200 Subject: [PATCH] Added doc example for collections using checked: --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3eadcad1c..6d379d0e9 100644 --- a/README.md +++ b/README.md @@ -279,9 +279,15 @@ BootstrapForms also provide helpful helpers that automatically creates the ``` Collection methods accept these options: -* `:label`: Customize the `form_group`'s label; -* `:hide_label`: Pass true to hide the `form_group`'s label; -* `:help`: Add a help span to the `form_group`; +* `:label`: Customize the `form_group`'s label +* `:hide_label`: Pass true to hide the `form_group`'s label +* `:help`: Add a help span to the `form_group` +* `:checked`: A collection of the selected/checked values. Can be ids or objects: + + ``` + <%= f.check_boxes_collection :skills, Skill.all, :id, :name, checked: Skill.find([1,2]) %> + <%= f.check_boxes_collection :skills, Skill.all, :id, :name, checked: [1,2] %> + ``` * Other options will be forwarded to the `radio_button`/`check_box` method; ### Prepending and Appending Inputs