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 /所有工作时,我的预期如何。
问题出在哪里,以及如何解决?
答案 0 :(得分:0)
试试这个:
module Admin
class ApplicationController < ::ApplicationController
end
end
module Admin
class HomeController < ApplicationController
end
end