I know how to pass parameters in a dumb way. For instance,
<%= link_to "Order", new_order_item_path(:item_id => @item.id) %>
OrderItemsController gets it as params[:item_id] = id
.
Problem:
@order_item = OrderItem.new(params)
throws an exception (cannot assign protected attributes: action, controller). I can get around this with the following code.
@order_item = OrderItem.new @order_item.item_id = params[:item_id]
I know that the controller needs params[:order_item][:item_id]
for the new one to work first. My question is: how do I get new_order_item_path
to generate the url? I know that this is not a serious problem, but it just seems to me that I do not know how to do it. I tried the search but only got unrelated questions / answers / results.
thanks
source share