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
This comes a bit late but this is how to turn off this by default in rails 5:
config/initializers/new_framework_defaults.rb
Rails.application.config.active_record.belongs_to_required_by_default = false
In case you don't want to add optional: true to all your belongs_to.
optional: true
belongs_to
I hope this helps!