Protect my admin namespace

Hi all.

I’ve an admin namespace in my app with some controllers.

What’s the best approach in order to login protect all of them?
I’m thinking about using before_filter, but I can forget to add it to
an new controller, in the future.
Googling for it, I’ve found this:
http://rpheath.com/posts/302-directory-based-authentication-in-rails

As I’ve read in the article’s comments, I could use an admin
superclass. But I can forget to inherits from it too.

So, my question is: what’s the best approach to my problem?
An Module? Superclass? before_filter?

Thank you very much and sorry for my poor English.

Davi V.

Restful authentication plugin

Create a admin/base_controller

with before_filter :login_required

And inherit from this controller class Admin::BooksController <
Admin::BaseController

You only need to remember to add the inheritance in new admin
controllers…

done

This is how I have seen it done, and how I do it myself.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs