I have to implement a role system in my app for authorization. We have around 5 kind of roles in our system.
To maintain these roles we have 2 options,
Alternative #1
1.Create an enum in rails Role model,
enum role: {super_admin: 1, translator: 2, approver: 3, sales_admin: 4, marketing_admin: 5, guest: 6}
2.In the Roles table , now we will have ID user_id role_id
Alternative #2
1.Create 2 models Role and Role_User.
Role table will only contain ID | role_name and Role_User will contain ID | user_id | role_id
Which should be preferred?