Best practice - controllers

My application will have a dynamic home page, which is further
personalised if the user logs in, as well as admin functionality.

Should I go for 3 controllers:

  • home
  • home+(user personalisation)
  • admin

Or should I have a single controller for the home page?

Thanks

It really depends on how personalized the page will be for a logged-in
user or admin. If there are just a few actions that are only accessible
for logged-in users or admins, then I’d say a single controller would
be the way to go. However, if there’s a full-fledged
control-panel-style thing going on, it would make sense to split that
off into something separate.

If I were you, I’d probably make the home page itself the same for all
three, with elements that need to switching based on who’s viewing, and
then have user and admin control panel controllers that use the same
layout.

I started with the classes generated by the login generator, then
extended those into a role-based security model. Here are my
controllers (so far) for the security administration.

account_controller.rb
applications_controller.rb
indaction_controller.rb #action is a reserved word, so
ind(irect)action is used
role_controller.rb
user_controller.rb

The HABTM relationships roles_users and indactions_roles are not shown.

The home page is the same for anyone, with it contents generated
dynamically at successful login.

Hope this helps.