控制器:
class SearchController < ApplicationController
def index
end
end
的routes.rb
get "search/index"
来自rake routes
search_index GET /search/index(.:format) search#index
当我尝试转到http://localhost:3000/search
时,我收到了404页错误...
答案 0 :(得分:4)
您的路线应为:
search_index GET /search(.:format) search#index
将您的get "search/index"
更改为:
resources :search, :only => [:index]