也许是这样的?
User
  has_many :bookmarks
  has_many :posts, through: :bookmarks
  has_many :authored_posts, foreign_key: :author_id, class_name: 'Post'
Bookmark
  belongs_to :post
  belongs_to :user
Post
  belongs_to :author, class_name: 'User'
  has_many :bookmarks
  has_many :users, through: :bookmarks
通过这种方式,您可以将用户撰写和添加书签的帖子分开。您还可以对其进行设置,以便每当作者创建帖子时,它都可以自动被用户添加书签。IE
class PostsController < ActionController::Base
  def create
    @post = @user.authored_posts.build(post_params)
    @user.posts << @post
    if @post.valid?
      # do good stuff
    else
      # do errors
    end
  end
end
author 和 authored_posts 之间存在很强的 1:N 关系。然后,使用 Bookmark 作为连接模型的用户和帖子之间存在较弱的 N:M 关系。您可以在使用上面的控制器代码创建已创作的帖子时将其添加为书签。删除已创作帖子上的书签只会将其从posts关系中删除,但不会从关系中删除authored_posts。
您不能使用相同的名称定义多个关系。