I am creating an inventory management application with four different types of users: admin, employee, manufacturer, transporter. I haven't started coding yet, but this is what I think about. Manufacturers and carriers are associated with has_many: through a many-to-many relationship with products as follows:
class Manufacturer < ActiveRecord::Base has_many :products has_many :transporters, :through => :products end class Product < ActiveRecord::Base belongs_to :manufacturer belongs_to :transporter end class Transporter < ActiveRecord::Base has_many :products has_many :manufacturers, :through => :products end
All four user types can be logged in, but they will have different permissions and views, etc. I donβt think that I can put them in the same table (Users), since they will have different requirements, i.e. suppliers and manufacturers must have a billing address and contact information (through verification), but administrators and employees should not have these fields.
If possible, I would like to have one login screen, and not 4 different screens.
I am not asking for the exact code to build this, but I am having trouble deciding the best way to do this. Any ideas would be greatly appreciated - thanks!
authentication ruby ruby-on-rails roles
aguynamedloren
source share