1
route ->
 namespace :admin do
   get '' => 'home#index'
 end


 class Admin::ApplicationController < ActionController::Base
 layout 'admin'

 class Admin::HomeController < Admin::ApplicationController

当我第一次只打开 /,然后打开 /admin/ rails 时,我会看到这个:

 home_controller.rb:1: warning: toplevel constant ApplicationController referenced by     Admin::ApplicationController

但是当我第一次到达 /admin/ 时,所有工作都按预期进行。

问题出在哪里,如何解决?

4

1 回答 1

0

尝试这个:

module Admin
  class ApplicationController <  ::ApplicationController
  end
end

module Admin
  class HomeController < ApplicationController
  end
end
于 2013-09-16T12:42:11.317 回答