如何在用户和博客之间命名has_many通过连接模型?

时间:2012-01-10 16:31:03

标签: ruby-on-rails activerecord active-relation

我不是母语为英语的人,但如果你是,你会如何命名这个Rails ActiveRecord连接模型“???”以语义方式?

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 ???

像“Blogger”这样的东西听起来不太好:用户has_many:博客

1 个答案:

答案 0 :(得分:1)

我想我会选择“作者身份”。对我而言,“博客”是写博客的过程。当然,重要的是所选择的单词对你有意义,因为你是那个需要记住与他们一起工作时意味着什么的人。