Model newb qustion

Just started learning about Rails and I’m trying to figure modeling
out in my head and I was hoping for some direction. Maybe I am
thinking too much and have confused myself but I figure if I don’t get
it right now it may get worse in the future. This is my first attempt
to create a site:

So I am trying to model users. There are multiple users with different
access rights. So what is not right in my head is this:

-Do I create one User model and then within the table distingush the
different users in a field?

or

-Do I create a model for each of the users? (Like: Admin model, Agent
model, Tutor model, Parent model, Student Model …)

In my model I have agents, tutors, parents, students, and admin.
Tutors provide services that can be purchased through the site by
students or parents. The Tutors are signed up to an account by agents.

Which would be right from the following?
Agents have many tutors
or should I say
Agents have many accounts (and then tie the tutor to the account?
which I guess would then be accounts have one tutor?)

I’m wondering if I just answered my first question about what should
be a model or not. If an object has associations then is it
automatically a model?

One of the things that is making me think that there should only be
the one User model is that if I have a login system and each user
group sees something different then how does the login controller
check against multiple different user groups in different models?

Thanks for any help in advance.

MC

On Sep 19, 11:13 am, MC [email protected] wrote:

different users in a field?
Which would be right from the following?
the one User model is that if I have a login system and each user
group sees something different then how does the login controller
check against multiple different user groups in different models?

Thanks for any help in advance.

MC

How about having a User and Role model and having them associated with
each other via a HABTM or a has_many :through?

Why not use Single Table Inheritance where you have a column ‘type’ for
storing the type of user. Then you will be having a single User model.

I think this might be helpful to you:
http://wiki.rubyonrails.org/rails/pages/SingleTableInheritance

Also in the Book Practical RAils Social Networking Sites the author
Alan B. works
through this by using a role model and assigning roles to the users.
The Administrator then controls who has what role. You might look at
this method

I am a newb also - so books and forems help alot - Owen

On Sep 19, 5:53 am, ruby rails [email protected]