On Nov 29, 2010, at 5:07 PM, Luk Mus wrote:

> Can't get array. The controller gets only 1 parametr.
> 
> Form in view:
> 
>>> <div class="field">
>>>    <% Categor.all.each do |cat| %>
>>>       <%= check_box_tag(:prodcat,cat.id) %>
>>>       <%= label_tag(:prodcat, cat.title) %><br>
>>>    <% end %>
>>> </div>
> 
> Controller:
> 
>>> params[:prodcat].each do |cat|
>>>   @pc=Prodcat.new(@product.id,cat)
>>>   @pc.save
>>> end
> 
> How i can get array?

In view...

<%= check_box_tag('prodcat[]', cat.id) %>

Would be one way...

-philip

> 
> -- 
> 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 [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
> 

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to