我正在学习伯克利软件即服务课程,但无法确定创建“查找类似电影的 RESTful 路线”所需的内容。
我的电影控制器中有这个:
def find_by_same_director
@movies = Movie.find_by_director params[:id]
end
我在 routes.rb 中尝试尽可能多的变体:
match 'movies/find_by_same_director/:id' => 'movies#find_by_same_director'
但是无论我做什么,当我运行我的 Cucumber 时,我都会遇到同样的错误:
No route matches
{:action=>"find_by_same_director",:controller=>"movies", :id=>1}
(ActionController::RoutingError)
我是 Rails 的新手,所以我想我只是没能正确理解要将控制器动作识别为路由必须做什么。谁能指出我正确的方向?