# Check\_bo\_tags collections

**URL:** <https://www.ruby-forum.com/t/check-bo-tags-collections/135222>\
**Category:** Rails\
**Created:** [April 19, 2008, 11:26am UTC](https://www.ruby-forum.com/t/check-bo-tags-collections/135222 "2008-04-19T11:26:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lostwarrior](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a88e57/32.png) [@lostwarrior](https://www.ruby-forum.com/u/lostwarrior)\
**Post date:** [April 19, 2008, 11:26am UTC](https://www.ruby-forum.com/t/check-bo-tags-collections/135222/1 "2008-04-19T11:26:12Z")

</div>

I have a collection of check\_box\_tags that look like the following:

\<% City.find(:all).each do |g| %\> - \<%= check\_box\_tag 'city',g.id,:checked=\>'checked'%\> \<%= g.name.capitalize %\>
\<% end %\>

My question is how i send all of the current checkbox values.Please give  
me some suggestions.

Thanks in Advance,  
Lostwarrior

---

<div class="post-metadata">

**Author:** ![lostwarrior](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a88e57/32.png) [@lostwarrior](https://www.ruby-forum.com/u/lostwarrior)\
**Post date:** [April 21, 2008, 4:38pm UTC](https://www.ruby-forum.com/t/check-bo-tags-collections/135222/2 "2008-04-21T16:38:59Z")

</div>

look in your variable params[:city]. It should have an array of all the  
city id’s that are checked

---

<div class="post-metadata">

**Author:** ![lostwarrior](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a88e57/32.png) [@lostwarrior](https://www.ruby-forum.com/u/lostwarrior)\
**Post date:** [April 22, 2008, 8:36am UTC](https://www.ruby-forum.com/t/check-bo-tags-collections/135222/3 "2008-04-22T08:36:36Z")

</div>

Mike Nicholaides wrote:

> look in your variable params[:city]. It should have an array of all the  
> city id’s that are checked

Thank u for ur suggestions.  
I have done as per that  
In views:  
\<% City.find(:all).each do |g| %\>

- \<%= check\_box\_tag 'article\_logicalarticle',g.id,checked=false,{:name =\> "article\_logicalarticle[city\_id][]", :id =\> "city\_id\_#{g.id}"}%\> \<%= g.name.capitalize %\>
\<% end %\> In controller i have writtem the code: params[:article\_logicalarticle][:city\_id].each do |city\_id| @article\_logicalarticle=ArticleLogicalarticle.new(params[:article\_logicalarticle]) @article\_logicalarticle.article\_id=@article.id @article\_logicalarticle.logicalarticle\_id=@logicalarticle.id @article\_logicalarticle.city\_id=city\_id @article\_logicalarticle.save
