Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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,793 Points

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