开发者

Rails has_one, include or join

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜