# Syntax to invoke form.check\_box for elements of a hash

**URL:** <https://www.ruby-forum.com/t/syntax-to-invoke-form-check-box-for-elements-of-a-hash/104148>\
**Category:** Rails\
**Created:** [May 14, 2007, 8:02pm UTC](https://www.ruby-forum.com/t/syntax-to-invoke-form-check-box-for-elements-of-a-hash/104148 "2007-05-14T20:02:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhwinters](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3da27b/32.png) [@jhwinters](https://www.ruby-forum.com/u/jhwinters)\
**Post date:** [May 14, 2007, 8:02pm UTC](https://www.ruby-forum.com/t/syntax-to-invoke-form-check-box-for-elements-of-a-hash/104148/1 "2007-05-14T20:02:43Z")

</div>

I have a model which contains a hash of boolean items, like this:

@role\_flags={“Owner”=\>0, “Administrator”=\>0, “User”=\>0, “Teacher”=\>0,  
“HoD”=\>0, “Timetabler”=\>0}

I would like to use form.check\_box to generate check\_box fields for  
each item but I can’t work out the way to pass the individual entries  
in the hash to form.check\_box - neither the Pragmatic book nor the  
Rails on-line documentation seems to cover it.

I’m pretty new to Ruby so please excuse me if this is a very stupid  
question, but can someone give me a pointer please?

TIA,  
John
