I’m doing the Berkeley Software as a Service course, and just can’t work out what is needed to create “a RESTful route for Find Similar Movies”.
I have this in my movies_controller:
def find_by_same_director
@movies = Movie.find_by_director params[:id]
end
I’m trying as many variants of this in routes.rb as possible:
match 'movies/find_by_same_director/:id' => 'movies#find_by_same_director'
But whatever I do I keep running into the same error when I run my Cucumber:
No route matches
{:action=>"find_by_same_director",:controller=>"movies", :id=>1}
(ActionController::RoutingError)
I’m new to Rails so I imagine I’ve just failed to correctly understand what it is one has to do to have a controller action recognized as a route. Can anybody point me in the right direction?
Your
config/routes.rbshould have something like or simmilar:Your
app/controllers/movies_controller.rbshould have an action with the same name!You should create a view like this:
And for cucumber, your
features/support/paths.rbshould have this line or simmilar:This is the rails app cook recipe and the cucumber setup for knowing the exatcly route!