Problem with nested form using collection_select and date_select

Hello people

I have a table named Items. Items belongs_to inventory, and Items
belongs_to product.

so items looks like

Item
-id
-inventory_id
-product_id
-date
-comments

The main idea is that I want to create an item while I’m creating the
inventory by using nested form in the inventory form (I already test
creating item with its own methods and forms and works fine), and I
get an error message saying that “product_id” is null and it shouldn’t
be null (because of foreign key restriction).

In the items form I have a collection select to display the name of
product, instead of just the id of the product, but when I check the
sql, product_id is a null value.

The same happens with date. I have a date_select in the form, but the
sql shows a null value.

I’ve already used nested form and worked fine, but now, I don’t know
what’s the probl
em. I followed this tutorial

Hope you can help me thanks