Seems a little odd what you are doing however to answer your question:

You can add a text_field_tag or a select_tag to your form

http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#M001731

e.g.

<%=text_field_tag :quantity%>

You can then get that via params[:quantity] in your controller from 
there you can either pass to your model/business logic class or do a 
simple:

1.upto(params[:quantity].to_i) do |i|
  Product.create!(params[:product])
end

Personally though I would seriously consider relooking at the way you 
are working and perhaps normalize your data so you have 3 models:

location
  has_many :products

type
  has_many :products

product
  belongs_to :location
  belongs_to :type

Then you can do the reverse and use fields_for to add multiple products 
to a location. Similar to this 
(http://railscasts.com/episodes/196-nested-model-form-part-1)

Cheers
Luke
-- 
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