Validation failed Class must exist

Try the following:

belongs_to :city, optional: true

According to the new docs:

4.1.2.11 :optional

If you set the :optional option to true, then the presence of the
associated object won’t be validated. By default, this option is set
to false.

Leave a Comment