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'
我的錯誤是什麼?
這是我愚蠢的錯誤,通過BTW我定你的答案一點點。 – megas