Не может иметь has_many: сквозная ассоциация до определения сквозной ассоциации - PullRequest
0 голосов
/ 30 апреля 2020

У меня есть код

  has_many :users_roles,
           dependent: :destroy

  has_many :roles,
           through: :users_roles,
           dependent: :destroy

  accepts_nested_attributes_for :users_roles

, но это вызывает у меня ошибку Cannot have a has_many :through association 'User#roles' which goes through 'User#users_roles' before the through association is defined.

Я не понимаю, думаю, мой код выглядит правильно. Это произошло после миграции с рельсов 5,2 на рельсы 6

...