0

控制器:

class SearchController < ApplicationController

  def index

  end

end

路线.rb

get "search/index"

rake routes

search_index GET    /search/index(.:format)        search#index

当我尝试访问时,http://localhost:3000/search出现 404 页面错误...

4

1 回答 1

4

您的路线应该是:

 search_index GET    /search(.:format)              search#index

将您更改get "search/index"为:

resources :search, :only => [:index]
于 2012-07-23T20:20:44.143 回答