Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. COI think STI was exactly what I was looking for. I'll experiment with it and see if it fits... Clarification, though: when you say that the latter method has "the advantage of allowing multiple roles"... what exactly do you mean here? Couldn't I still do `class Agent < User` and `class Client < User` ?? Still a bit confused.
      singulars
    2. COOn further investigation, it looks like Polymorphic Association would be a better fit for me. See this article: http://www.andygoh.net/2008/06/19/ruby-on-rails-polymorphic-association/ Still having trouble wrapping my head around actually using these associations, though... unfortunately, Ryan Bate's screencast on the subject is almost the exact reverse of what I want to accomplish (whereas he has a model that belongs to many other models, I want a model that has many other models)...?
      singulars
    3. COWhat I meant by the multiple roles comment was that a single User could have multiple roles associated with it, whereas with STI a user assumes a single role. Polymorphic associations can be good for some circumstances, but since they are impossible to enforce with foreign key constraints, and because joins with them always require a compound key, they are best left on the fringes of your database design. When part of the core they can be a nuisance. STI is "database friendly" since the type information is only relevant to the ORM, not the DB.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload