Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 4 Runtime error in controller: Circular dependency detected while autoloading constant

Let me know if I left anything out. I can't figure out why my views/references/ folder isn't accessible. neither new.html.erb nor index.html.erb is available. When I go to localhost:3000/references my error is:

RuntimeError in ReferencesController#index
Circular dependency detected while autoloading constant ReferencesController

I believe this is setup, and It shouldn't be a Rails issue because my other controllers are working fine.

My routes file has resources :references in it, my rake routes produces:

references GET    /references(.:format)          references#index
           POST   /references(.:format)          references#create
new_reference GET    /references/new(.:format)      references#new
edit_reference GET    /references/:id/edit(.:format) references#edit
reference GET    /references/:id(.:format)      references#show
           PATCH  /references/:id(.:format)      references#update
           PUT    /references/:id(.:format)      references#update
           DELETE /references/:id(.:format)      references#destroy

So I try to get to my index page by this which should be the correct path.

<%= link_to 'References', references_path, class: 'navbar-brand' %>

My model:

class Reference < ActiveRecord::Base
  belongs_to :user
end

My controller:

class ReferencesControllers < ApplicationController
  def index
    @references = Reference.all
  end

After Google searching, every similar problem seems to be when upgrading from Rails 3 to Rails 4, or updating from OS to mavericks. My other controllers work so I feel it's safe to rule those out. I can't even get to the templates.

like image 456
user3138341 Avatar asked Mar 12 '14 17:03

user3138341


1 Answers

Rename this ReferencesControllers to ReferencesController

like image 118
Vasu Adari Avatar answered Nov 03 '22 01:11

Vasu Adari