Circular dependency detected while autoloading a constant

五迷三道 提交于 2019-12-06 02:57:49

This kind of issues often happen when you change the version of Rails. You maybe didnt update the gems on the right order.

Best I'm aware, circular dependencies error messages usually occur when cascading includes go wrong by recursively requiring a file before it is fully loaded, e.g.:

# File A:
require 'B'
module Foo; end

# File B:
require 'A'
module Foo; end

Any odds this is the kind of situation you're ending up with?

I had this error because I manually renamed controllers, routes etc etc and forgot to rename it in the first line of the files.

Was named

class AController < ApplicationController

instead of

class ARenamedController < ApplicationController

and I had gone and renamed all the other files individuall.

Not best practice I know, but I am learning and figuring it out, and in this case created the error this person is talking about. So if you got here through Google like I did, there is my solution.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!