awendt
awendt

Reputation: 13663

Why does Rails define a controller action when merely a view exists?

I just spent a good deal of time trying to debug a controller action that was erroneously marked protected. When I commented out the action and Rails didn't respond with Unknown action as I'd expected, I became suspicious.

Turns out that having an appropriately named view is enough for Rails to define a controller action. So my two questions are:

  1. Why on Earth does Rails do that? To help newbies?
  2. Can I keep Rails from doing this with some piece of config?

Upvotes: 2

Views: 111

Answers (1)

Wahaj Ali
Wahaj Ali

Reputation: 4103

This might not answer all your question, but the Rails Guide on rendering discusses this in the section Rendering by Default: Convention Over Configuration in Action

Upvotes: 3

Related Questions