Say I have a model consisting of Order( has_many :order_lines) and
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 no: <%= @order.no %>
Date <%= date_select “order”, “date” %>
<% 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
to write the input tag by hand.
View this message in context:
Sent from the RubyOnRails Users forum at Nabble.com.