Check_bo_tags collections

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

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

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]) @[email protected] @[email protected] @article_logicalarticle.city_id=city_id @article_logicalarticle.save