views:

32

answers:

1

Everytime i get a warning:

app/controllers/agency/agencies_controller.rb:1: warning: toplevel constant ApplicationController referenced by Agency::ApplicationController

My agencies_controller.rb:

class Agency::AgenciesController < Agency::ApplicationController

  def index
    ...
  end 

  ...
end

And Agency::ApplicationController:

class Agency::ApplicationController < ApplicationController
  layout 'agency'

  helper_method :current_agency
  private

  def current_agency
    @current_agency ||= current_user.agency 
  end

end

What the rails wants from me? What is the trouble?

Same situation with another controller

class Agency::ClientsController < Agency::ApplicationController
  ...
end

And no warnings, no errors...

A: 

ApplicationController is the name of the superclass controller that Rails generates for you when you create a new project that all your other controller classes inherit from. There's probably a conflict somewhere because you've used the same name, even though you put it within a namespace.

Try giving your Agency::ApplicationController a different name.

John Topley
But why there are no troubles with Agency::ClientsController??
petRUShka
Because `ClientsController` doesn't have a special meaning to Rails.
John Topley