Marnen Laibow-Koser wrote:
> Rick wrote:
> [...]
>> I'm new so I don't have the full answer, but without the favorite 
>> boolean,
>> behind the scenes I think a table of  "HobbyFavorite" would be needed 
>> that
>> has person_id and hobby_id, unless I'm missing something.
> 
> Since there would be a 1:1 association between Person and HobbyFavorite, 
> that would actually be functionally equivalent to just having a 
> hobby_favorite_id in Person.

That is exactly how the database looks.  Instead of people and hobbies, 
my code actually uses Users and Characters.  The People/Hobby was just 
another example.  Each user can have any number of characters, but only 
one character is marked as the "selected character".

The users table has a selected_character_id, and the characters table 
has a user_id.

Thanks.
-- 
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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to