开发者

ruby on rails models

开发者 https://www.devze.com 2023-03-16 21:30 出处:网络
I am writting social network. I have grou开发者_运维技巧p\'s blog and user\'s blog, then I have group\'s photos and user\'s photos

I am writting social network. I have grou开发者_运维技巧p's blog and user's blog, then I have group's photos and user's photos How I must design models? all posts(photos) in one db table or in different?


It is preferable to have a single table only for photos, especially if you have multiple photos for each group or user. You could use Single Table Inheritance or Polymorphic Associations to store photos from groups and users in it. I would recommend to read some good books about the topic, Practical Rails Social Networking Sites and RailsSpace: Building a Social Networking Website with Ruby on Rails. Both are recommendable.

0

精彩评论

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