On Sep 19, 11:13 am, MC <[EMAIL PROTECTED]> wrote:
> 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

How about having a User and Role model and having them associated with
each other via a HABTM or a has_many :through?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to