Im not sure how to name this question, but Im stucked with kind of an reverse relations in Rails 4. Let me explain it on a real-life example
Order has_many OrderFiles and OrderFile belongs_to Order
My app logic is like this (marketplace like):
- User upload some file on the /create_new_order/ page. OrderFile object is saved to the database using form_for OrderFile.new
- User searching for the Performer of the Order, apply filters, etc..
- User click "Make order" and on certain person. Order object is created
But, how do I link OrderFile to the Order? It's quite simple when the Order is created first. But when the File is first, how may rails know which order_id link to?