I tried to add concern for a specific model like in this project:

https://github.com/catarse/catarse/blob/master/app/models/concerns/user/omniauth_handler.rb

https://github.com/catarse/catarse/blob/master/app/models/user.rb

I get the error Circular dependency detected while autoloading constant ModelName::ConcernsName . True only on production.

To solve the problem I wrapped

 module Concerns module ModelName::ConcernsName end end 

and accordingly include Concerns::ModelName::ConcernsName

Why does this work in Catarse?

PS Error occurs only for two of the 4 models. At the same time I cannot classify them.

PPS Having completely cleared the module of the admixture from the code and the class of the model for which an error occurs - the error persists. So it hardly depends on their contents.

  • What version of Rails do you have? - D-side
  • rails version 4.2.6 - shadeofpast

0