Sindri Guðmundsson wrote:
> Marnen Laibow-Koser wrote:
>> Sindri Guðmundsson wrote:
>>> If this helps these are the parameters passed when I use check_box:
>>> 
>>> 
>>>   Parameters: {"commit"=>"Vista mælitæki", 
>>> "authenticity_token"=>"B2u5ULNr7IJ/ta0+hiAMBjmjEtTtc/yMAQQvSxFn2d0=", 
>>> "cats"=>{"flokkur"=>[nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 
>>> nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil]}}
>> 
>> And what does that version of the view code look like?
>> 
>> Best,
>> --
>> Marnen Laibow-Koser
>> http://www.marnen.org
>> mar...@marnen.org
> 
> Hi,
> It looks like this now;
> 
> 
> <%form_for :cats, :url => {:action => :save_mt} do |form|%>
>   <%...@flokkar.each do |flokkur|%>
>   <p>
>     <%= form.check_box 'flokkur[]' %>
>     <%= flokkur %>
>   </p>
>   <%end%>
>   <%= submit_tag "Vista mælitæki", :class => 'submit'%>
> <%end%>
> 
> 
> I've tried different parameters for the check_box but to no success...
> 
> BR,
> Sindri

Finally got it, the empty hash did the trick ;) Thanks though :)

<%form_for :cats, :url => {:action => :save_mt} do |form|%>
  <%...@flokkar.each do |flokkur|%>
  <p>
    <%= form.check_box flokkur, {}, "yes", "no" %>
    <%= flokkur %>
  </p>
  <%end%>
  <%= submit_tag "Vista mælitæki", :class => 'submit'%>
<%end%>
-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to