Circular dependency detected while autoloading a constant
I upgraded Rails from version 3.1.2 (which worked fine) to 4.0, and got stuck with the following error: circular dependency detected while autoloading constant Foo I created a class ProductFactory , where I instantiate different models. For example: p = Foo.new(params) The model "Foo" is not always an ActiveRecord. Could anyone help me with this issue? 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