When creating a new product and assigning the categories it belongs to
(via
a multi select) the records are not getting added into my join table
(category_id, product_id) but the product details are getting saved to
the
product table just find. Do I need to do anything extra for the joining
table or should rails work this out for me?
On Thursday, November 21, 2013 12:28:18 PM UTC, Alan T. wrote:
Hi
When creating a new product and assigning the categories it belongs to
(via a multi select) the records are not getting added into my join table
(category_id, product_id) but the product details are getting saved to the
product table just find. Do I need to do anything extra for the joining
table or should rails work this out for me?
When creating a new product and assigning the categories it belongs to (via
a multi select) the records are not getting added into my join table
(category_id, product_id) but the product details are getting saved to the
product table just find. Do I need to do anything extra for the joining
table or should rails work this out for me?
You need to show us the relationships you have defined between the
models (has_many, etc) and the code you are using to save the records
(not the whole application, just the code saving the data). Also
useful is the contents of the log for the POST operation, showing the
parameters passed. Examine this carefully yourself first, however,
and possibly put some debug code in to try and work out what is
happening. You can insert puts statements in the code and these will
appear in the server window.
Colin
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.