I am using a controller method search_same_director. The link code from show.html.haml:
= link_to 'Find Movies With Same Director','/movies/search_same_director', :director=>@movie.director
I have added the following line to routes.rb
match '/movies/search_same_director'=>'movies#search_same_director'
But the link routes the request to the show action. How can I correct this?
You’ve set up the route, so use the rails path in the view:
And since you’re passing
directorto the action, change the match statement inroutes.rb:Also, make sure the
matchstatement is above theresources :moviesstatement in the routes file.