I have two user types in my application: Investors and Advisors, they both have a separate model and table in database (Investor model, Advisor model, Investors table and Advisors table).
I need to create a table to keep advisor’s profile data and a different table to keep investor’s profile(they have completely different fields in profile, so i cant merge into a single table). What name should i give to it? If i call it investor_profile – then every time i want to get a data from it i have to call it investor->investor_profile->field_name but thats seems bad to type investor twice.
Any advises for a proper name? Or maybe a trick to make it investor->profile->field_name?
Thank you.
You might store different tables for
investor_profilesandadvisor_profileswith separate modelsInvestorProfile, AdvisorProfile(which both might inherit from a baseProfileclass, assuming they have at least a tiny bit of overlap).But in your model associations, use the
:class_nameoption to hide the_profiles:In practice then, you can refer to it as
self.profile:See the
ActiveRecord::Associationsdocumentation for descriptions of the options.