开发者

In a Facebook-like social network programmed in Rails, where in the database would you store that a user "likes" a Page?

I'm creating a social network in Rails. I have a User model and a Page model. Users can "follow" or subscribe to Pages. So a user can have many pages and a page can have many users. How wou开发者_高级运维ld these relationships be stored in the database? Do I need to create a new object Subscription which belongs_to :user?


Generally this is done with a "join model", which would be UserPage, and a user_pages table. You could call it Subscription if you wanted, but Rails will reward you for sticking to its expected semantics.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜