I have a collection of check_box_tags that look like the following: <ul id="check"> <% City.find(:all).each do |g| %> <li> <%= check_box_tag ''city'',g.id,:checked=>''checked''%> <%= g.name.capitalize %></li> <% end %> </ul> My question is how i send all of the current checkbox values.Please give me some suggestions. Thanks in Advance, Lostwarrior -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
look in your variable params[:city]. It should have an array of all the city id''s that are checked -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mike Nicholaides wrote:> look in your variable params[:city]. It should have an array of all the > city id''s that are checkedThank u for ur suggestions. I have done as per that In views: <% City.find(:all).each do |g| %> <li> <%= check_box_tag ''article_logicalarticle'',g.id,checked=false,{:name => "article_logicalarticle[city_id][]", :id => "city_id_#{g.id}"}%> <%= g.name.capitalize %></li> <% 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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---