我在建立我的观点时遇到了很大的问题..每当我转到我的页面localhost/clear时,我都会得到No route matches [GET] "/clear".
我在控制器中有一个名为clear的文件夹,里面有控制器文件。
我如何将其设置为:
localhost/clear as main view,
and other one as
localhost/clear/connect
localhost/clear/testbase_controller.rb
class Clear::BaseController < ApplicationController
def index
end
end connect_controller.rb
class Clear::ConnectController< Clear::BaseController
def index
@functions
end
endroutes.rb
resources :clear, only: :index
namespace :clear do
resources :connect, only: :index
resources :test, only: :index
end发布于 2021-03-20 22:00:21
您错过了到/clear的路由
# routes.rb
namespace :clear do
resources :base, only: :index, path: '/'
resources :connect, only: :index
resources :test, only: :index
end下面是如何检查您拥有哪些路径的方法
rake routes | grep clear
# =>
clear_base_index GET /clear(.:format) clear/base#index
clear_connect_index GET /clear/connect(.:format) clear/connect#index
clear_test_index GET /clear/test(.:format) clear/test#indhttps://stackoverflow.com/questions/66722138
复制相似问题