Database and model design for multiple user roles

17 views
Skip to first unread message

pavlos kallis

unread,
Mar 25, 2012, 4:52:10 AM3/25/12
to rubyonra...@googlegroups.com
I would like to create a web application that has two types of users, producer and consumer.
Both users have three fields in common : username,password and email. Producer has also the fields address and telephone.
I could make separate models,views,controller and tables for each user types but this violates DRY. Could Single table inheritance be used and how?

Colin Law

unread,
Mar 27, 2012, 12:28:25 PM3/27/12
to rubyonra...@googlegroups.com

I would probably keep it simple and have a users table with all the
fields in (leave the ones you don't need empty) and use the cancan gem
to give the different types of users different roles.

Colin

Reply all
Reply to author
Forward
0 new messages