Say I have a model consisting of Order( has_many :order_lines) and OrderLine( belongs_to :order). What would be the 'rails way' to create an order form? Know I could just say @order = Order.some_order, @lines = @order.order_lines, and use something like this..: order.rhtml: Order no: <%= @order.no %> Date <%= date_select "order", "date" %> <hr /> <% for line in @lines %> # or use a partial.. ... Amount: <%= text_field "lines", "amount" %> <% end %> ..then add the lines to my Order in the controller. I feel though, that I should be creating my whole order with Order.new(params[:order]). Is that feasible/possible/the right way? If possible, please show me how i would call text_field with @order.order_lines.amount -- or what the id/name fields should be if I have to write the input tag by hand. -- View this message in context: http://www.nabble.com/%28Nested%29-collection-in-a... Sent from the RubyOnRails Users forum at Nabble.com.
on 2006-03-13 15:45