devise - A Rails app where the User is also a "something else", not sure how to word this correctly -
i working on rails app data model involves following:
companies
, have_manyrestaurants
restaurants
, have_manyreservations
customers
, mave_manyreservations
my confusion comes fact there 3 distinct types of users:
- an employee of
company
, can see admin dashboard showing data on of restaurants company owns/manages - the restaurant (which will, in theory, have dashboard open day, , should able log own dashboard, not able see other restaurant's dashboard)
- the customer, has ui make reservation @ restaurant
should restaurant
type of user
?
should each restaurant it's own standard user-login access specific restaurant? if case, restaurant have_one user
, , can use cancancan restrict users can access restaurant
restaurant's id == user.restaurant.id
?
this first app addressed atypical user
types, i'm @ complete loss on this. guidance/best practices on how address situation appreciated!
additionally, use devise user model(s). thanks!
i say, first of all, ever user logging website. restaurant can't log website. user representative of restaurant can log in. therefore restaurant should not type of user.
a better fit give users roles, , have 1 of roles "restaurant_manager" or something. these users naturally associated restaurant too, code like
if current_user.role == "restaurant_manager" #show links restaurant admin section elsif current_user.role == "company_manager" #show links company admin section
or along lines, and, suggest, make sure user can ever access own restaurant/company in restaurant/company admin sections.
Comments
Post a Comment