I have been (hours) trouble with associations in Rails. I found a lot of similar problems, but I couldn\'t apply for my case:
City\'s class:
class Ci
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.
params.require(:user).permit(:name, :citys_id)
It's a mistake, isn't it? (citys_id vs city_id)