views:

775

answers:

2

Hi All,

I've written an application controller that handles 99% of what I need any controller to do. I've posted it here (pastebin). Like I said, feel free to be harsh.

-update: added comments :)

Thx,

-C

P.S. I would like to say that my intention here is to overwrite methods that need different functionality in sub-classed controllers, such as the *message methods and the after* methods. The application controller will serve as a sort of abstract class. also, some of the before_filters are specific to plugins, such as tiny_mce and restful_authentication (which is awesome, imho.)

+1  A: 

This is not an answer to your question, but if you want to go further in this direction, you may want to take a look at Hobo. Its Hobo::ModelController does a lot of what your ApplicationController does.

Antti Tarvainen
A: 

Small thing, but I would make the object, model, and model_name methods private or protected. Other than that I didn't notice any mistakes.

Antti Tarvainen