I need to make a website structure in rails in which there are administrators, workers, and clients. The administrators need to have control over everything and be able to view everything, workers need to have control over just the clients and be able to view all the clients information, and clients have no control over anything, but can view their own data.
Whats the best way to accomplish this?
I was thinking about making an administrator model which has_many :workers and has_many :clients and then creating a worker model which has_many :clients and belongs_to :administrator and then creating a client model which belongs_to :worker. Is this the most efficient way to do this?
The standard way is make
UserandRolemodels. Then add some authentification gem like devise and also autorization gem like cancan where you can setup abilities for specific roles.in your case