0

在我的routes.rb文件中,我已将成员添加到电影资源:

resources :movies do
  get 'search', :on => :member
end

所以我有这个路线列表:

search_movie GET    /movies/:id/search(.:format) {:action=>"search", :controller=>"movies"}
      movies GET    /movies(.:format)            {:action=>"index", :controller=>"movies"}
             POST   /movies(.:format)            {:action=>"create", :controller=>"movies"}
   new_movie GET    /movies/new(.:format)        {:action=>"new", :controller=>"movies"}
  edit_movie GET    /movies/:id/edit(.:format)   {:action=>"edit", :controller=>"movies"}
       movie GET    /movies/:id(.:format)        {:action=>"show", :controller=>"movies"}
             PUT    /movies/:id(.:format)        {:action=>"update", :controller=>"movies"}
             DELETE /movies/:id(.:format)        {:action=>"destroy", :controller=>"movies"}

我希望在我看来使用这条路线如下:

= link_to 'Find Movies With Same Director', search_path(@movie)

但它出现了错误:

undefined local variable or method `search_path'

我的错误是什么?

4

1 回答 1

0

试试这个功能:search_movie_path

于 2012-06-24T23:38:05.693 回答