Forum: Ruby on Rails Database and model design for multiple user roles

Posted by pavlos kallis (Guest)
on 2012-03-27 12:01
(Received via mailing list)
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?
Posted by Colin Law (Guest)
on 2012-03-27 18:30
(Received via mailing list)
On 25 March 2012 09:52, pavlos kallis <pakallis@gmail.com> wrote:
> 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?

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
Posted by @iamreff (Guest)
on 2012-09-05 18:53
(Received via mailing list)
Interested to know which direction you went in since I'm working on this
issue now.

thanks.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.