Rails began the transaction of creating a new record but for some reason it couldn't do it. The validation method intervened before the record was saved. (0.2ms) begin transaction SQL (11.2ms) INSERT INTO "products" ("created_at", "expiration_date", "in_stock", "name", "price", "updated_at", "weight") VALUES (?

)

Ruby throws an Argument Error if the date is invalid and in that case, the function returns false.If the object is created, the date is valid, and if not, the date is invalid.