views:

60

answers:

1

I'd like to write my own authentication instead of using one of the plugins.

Should my authenticate method go in the application_controller?

My idea is to place it there and then in each of the controllers use a before_filter

before_filter :authenticate

So my authenticate method would just check if the user_id is present in the session. If it's not there, the user would be redirected to an error page. If it is there, they would be allowed to see whatever url they wanted to visit.

Does this sound right?

A: 

Well, that's one way to setup the restful_authentication plugin. So yes, your homebrew solution could use

before_filter :authenticate

as well.

Pete