I have controller code that needs to be shared between
multiple different user type views and want to know
what is considered ‘best practice’ or what other
people are doing out there.
Example: I have admin users, salesperson users, and
possibly another type of user. They all need code to
add/edit/delete a property - and other abilities. The
code would be identical(in most cases) but needs to
forward to different views. The wrong way to do this
would seem to be duplicating this code across multiple
Should this code be placed in a parent classes
protected methods and the subclass only contain public
methods which have calls to these methods and view
logic code? Or should this code be in a module? Or
should there be a single controller that figures out
the user type and goes to the appropriate view based
on that? Or is there another solution?
Thanks ahead of time for any answers.