Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby

LoadError in StatusesController#index

I am getting the following error, help please:

Unable to autoload constant ApplicationController, expected /Users/aliciatglenn/code/treehouse/app/controllers/application_controller.rb to define it

Extracted source (around line #1):

class StatusesController < ApplicationController
  before_action :set_status, only: [:show, :edit, :update, :destroy]

  # GET /statuses
  # GET /statuses.json
  def index

6 Answers

Alan Johnson
Alan Johnson
7,625 Points

Does a file exist at app/controllers/application_controller.rb for you?

Yes

Alan Johnson
Alan Johnson
7,625 Points

Sorry I've been MIA the past day - my family's in town visiting so I'm taking off, but I'll try to pull your code down and help out as soon as I can!

ok no problem, thanks :).

Alan Johnson
Alan Johnson
7,625 Points

What are you doing to get that error to happen? I just loaded up your repo and it's working fine for me right now.

I am going to localhost:300/statuses

Alan Johnson
Alan Johnson
7,625 Points

I just loaded up your app, and it's working fine for me when I go to /statuses. Really weird.

Have you tried stopping and starting your Rails server just to make sure nothing odd is happening there?

yes, just by clicking control c right? Could it be a rails 4 error? are the lessons updated?

Alan Johnson
Alan Johnson
7,625 Points

Ctrl-C is right! Just hit Ctrl-C and then start it back up again with rails s.

They're not updated to Rails 4 yet, but I ran your app earlier today and it worked fine, and I was using your Gemfile so was using whatever version or Rails you're on.

yea I've restarted my server several times, no luck.

This is the error i see at the top: RuntimeError in StatusesController#index Circular dependency detected while autoloading constant ApplicationController

Dave Faliskie
Dave Faliskie
17,781 Points

Did you ever solve this problem? I am having the same sort of issue.