I have two models, Product and Product_Methodology. In my product edit view I have a select form field to select one of many methodologies or none (empty first option). In my products table I have a
methodology_id property that gets saved with the id of the methodology selected from the select form field. Everything worked OK until today that I had to make an adjustment to the system in which since now selecting a methodology can be optional. So I changed the
methodology_id field of the products table to allow
NULL value and removed the
not_empty validation rule on the model.
The problem is that now when I save the model selecting the empty option, instead of the expected
NULL, I get a
0 (zero) value.
Any clue on this? Thanks a lot and let me know if it's not so clear.