Ruby on Rails Monday, July 11, 2016

On 11 July 2016 at 19:41, Johnny Stewart <lists@ruby-forum.com> wrote:
> No tutorial that I know of..
>
> You have the same information for all user types, namely just the
> important information for users. So - you keep password, username, first
> name, last name, email address etc in the User table.
>
> Stuff like sport, training ground, weight, height, body-fat etc would go
> in a table like AthleticInfo
>
> stuff like restaurant, food speciality, chef qualifications etc would go
> in a table like ChefInfo
>
> then if user1 is a chef, he would have all the user info + type Chef and
> he would have an entry in the chef table
>
> user2 if she was a footballer would have all the user info + type
> Athlete and she would have an entry in the athlete table
>
> So, you don't need to keep all the chef or athlete data in the user
> table - you just have a reference to that info in the relevant table..

That does not sound like STI, STI is where you *do* store all the
information in one table (Single Table Inheritance), but ignore the
irrelevant parts dependent on the type.

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuQgXxzuCz0yWxkHvs7t%3DBEJPy%3DZ8tmUo-8B-%3DxD%2B7xSQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment