I was wondering whats the best way to set up this DB structure in Rails 3...
I have a users table and a user_profiles table. The users_table contains 'name, email, pass, login_count'; the user_profiles table contains 'avatar, address' other info etc...
When I retrieve a user I need to bring back their profile da开发者_JS百科ta as well and when a user edits their profile they are editing data from both tables...
Whats the best way to set up the relationships between these tables?
has_one with belongs_to, include or join.... or is there a better or standard way? What would you do?
Thanks for the help! :)
has_one
and belongs_to
for you. Go through this rails cast to better understand it.
精彩评论