Colin Law wrote in post #1184575: > On 11 July 2016 at 19:41, Johnny Stewart <[email protected]> wrote: >> 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
As I understand it STI is best suited to situations where the data is the same but the behaviour is different. For the User model it really only has to handle registrations etc. I don't think there is any need to hold data pertaining to that user being a chef. All it needs is maybe profile name, email address, password etc. That needn't change here. Using STI we store that one extra column of type - then use that to see what table that user's extra info is held in (chef_info, athlete_info etc). J. -- Posted via http://www.ruby-forum.com/. -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/dad1c89db50a28e088b208571ee5c369%40ruby-forum.com. For more options, visit https://groups.google.com/d/optout.

