Sunday, March 30, 2008

Idea about restful_authentication plugin

If you're using the restful_authentication plugin with your rails projects, there's a simple idea which might be interesting to you.

Idea as I said pretty simple. Rename the users_controller which the plugin generates to profiles_controller, and sequentially change the routes declaration

# from
map.resources :users
# to
map.resource :profile

The reason is simple as well. With the controller you actually manage the user's profile (the registration process for example), not the users collection in really. For administration purposes you may need more standard CRUD controller for the User unit later. And you will extend the existing controller, then you may run into some ugly constructions in it pretty soon.

But with such a simple renaming you'll keep the things more clear and reusable.

No comments: