尝试设置路由路径,没有路由匹配
Trying to set up route paths, getting no route match
我在设置视图时遇到了大问题.. 每当我进入我的页面时 localhost/clear 我得到
No route matches [GET] "/clear".
我的控制器中有一个名为 clear 的文件夹,里面有控制器文件。
如何将其设置为:
localhost/clear as main view,
and other one as
localhost/clear/connect
localhost/clear/test
base_controller.rb
class Clear::BaseController < ApplicationController
def index
end
end
connect_controller.rb
class Clear::ConnectController< Clear::BaseController
def index
@functions
end
end
routes.rb
resources :clear, only: :index
namespace :clear do
resources :connect, only: :index
resources :test, only: :index
end
您错过了 /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#ind
我在设置视图时遇到了大问题.. 每当我进入我的页面时 localhost/clear 我得到
No route matches [GET] "/clear".
我的控制器中有一个名为 clear 的文件夹,里面有控制器文件。
如何将其设置为:
localhost/clear as main view,
and other one as
localhost/clear/connect
localhost/clear/test
base_controller.rb
class Clear::BaseController < ApplicationController
def index
end
end
connect_controller.rb
class Clear::ConnectController< Clear::BaseController
def index
@functions
end
end
routes.rb
resources :clear, only: :index
namespace :clear do
resources :connect, only: :index
resources :test, only: :index
end
您错过了 /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#ind