Forum: Ruby on Rails Rails 3: create input field for each element of a collection (MongoID)

Posted by Michael Imstepf (Guest)
on 2012-10-01 14:28
(Received via mailing list)
Hi all,

I have two models, Item and Bid

class Item
>   include Mongoid::Document
>   field :name, type: String
>   has_many :bids
> end
> class Bid
>   include Mongoid::Document
>   include Mongoid::Timestamps::Created
>   field :bid, type: Float
>   belongs_to :item
> end


In views/prices/index I would like to list all items in a table and for
each item put a field next it in which people can enter a number. At the
bottom of the form should be a submit button for all records.

How is this best achieved?
There's plenty of code out there explaining how to add, for instance, 
several
questions to one 
survey<http://railscasts.com/episodes/196-nested-model-fo... I 
couldn't find an example that shows how to add one new record for
each of of an existing element of a collection.

Thanks...
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.