I have an application on which a user can create multiple profiles of three kinds – social, professional and special interest. I have three models that store information about these profile types for a user. I need to create a drop down select menu of profile names for navigating between the views of these different profiles. I know it can be done using collection_select to populate from one database table, but how can I populate from all three tables?
Also can it be populated on a drop down navigation bar? Profiles -> View my profiles -> dynamically populate all profiles?
<ul id="nav" class="dropdown dropdown-horizontal">
<li><%= link_to("Profiles", new_profile_path()) %>
<ul>
<li><%= link_to("View my profiles") %>
<ul>
<li> *some way to populate my list here* </li>
</ul>
</li>
</ul>
.
.
.
Any help is appreciated. Thanks!
I would suggest that unless absolutely necessary, instead of having three separate models for the three different profile types, you can have one
Usermodel and a singleProfilemodel and then create an association between them. It will lead to cleaner design.If it is absolutely necessary that you have three different Profile models then you can populate the drop down like this.