I have never seen a Rails project which doesn’t have custom actions in the Rails controllers. And that makes me upset. Here I’m going to describe my thoughts about custom actions, why people use them, why I hate them, and how to deal with them.
Let’s say we want to build a simple posting system. We have already created a model Post and need to add a controller. Everybody knows about REST and we obviously want to build a RESTful application. So we create a controller: