2012-01-10 16 views
2

我不是英语母语的人,但如果你是,你会如何命名这个Rails ActiveRecord连接模型“???”以语义的方式?如何命名用户和博客之间的has_many通过连接模型?

User has_many :blogs, through: ??? 
User has_many ??? 

??? belongs_to :user 
??? belongs_to :blog 

Blog has_many :owners, class_name: 'User', through: ??? 
Blog has_many ??? 

像“博客”不健全的那么好:用户的has_many:博主

回答

1

我想我会用“的著者”去。对我来说,'bloggings'是写给博客的过程。当然,重要的是所选择的单词对你来说是有意义的,因为你需要记住与它们一起工作时的含义。

+0

不错!唯一的问题可能是与用户以类似方式链接的后续模型。 BlogAuthororship或BlogOwnership可以作为替代方案。 – svoop 2012-01-10 17:22:59

+0

甚至是一个多态的所有权连接模型。 – svoop 2012-01-10 17:42:21

相关问题