I’ve been doing a lot of work with pop up windows and have now come to
the “it all works, but this” point in my application.
I have an order application. With that I have a pop up window that
allows users to do some dragging and dropping of items for a portion of
the order. The problem is that the pop up uses the order id. The items
selected in the pop up window are saved back to the order record as a
user drags and drops items. Obviously works great with existing orders,
but blows up with new orders.
I am saving everything back to the order record. There is not a
separate table to hold the list for this item of the order.
Right now the I open the pop-up window using link_to and sending in the
id of the order. If it’s a new order, I get “Couldn’t find Order
without an ID”.
Since the Order ID is integral to everything working, what are my
options? Do I check for the order ID and if it’s not provided, start a
new order and save it to the database?
Or do I add a route for the model/pop_up?
Right now my route is map.resources :model, :collection => [“pop_up”]
Or is this a bigger, uglier problem that really can’t be attacked with
this design? If that’s the case, some ideas for how to fix, without
starting all over would be appreciated.