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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
johnson_d-j9pdmedNgrk@public.gmane.org
2006-Sep-18 12:14 UTC
Re: Best practice - controllers
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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---