Reputation: 67
It seems like as long as a route matches 'somecontrollername#show', there is a view for it: somecontrollername/show.html, and the controller is defined without the show action, a get request to the route automatically renders the show view.
Can somebody please explain this behavior?
Upvotes: 0
Views: 32
Reputation: 51151
This is how Rails work. If they have route for specific action, but this action is not implemented in appropriate controller, they try to render template named the same way as action. If they can't find this template, they throw an error.
Upvotes: 1
Reputation: 14038
You will have a resource route that automatically routes to a template show action like so:
resources :applicants # Controller for this resource can automatically serve REST requests
To remove it, in your route add except: [:show]
resources :applicants, :except => [:show]
Upvotes: 1