Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如,给定一个Book对象,它有几个Tags与之关联。我知道我可以轻松检索一本书的所有标签,但我如何检索书籍集合的所有标签。就像一团标签,但只有收藏书籍中的标签,而不是全部。
Book
Tags
book_id通过s 获取与书籍集合中的 id 匹配的标签。
book_id
Tag.where(:book_id => book_collection.map(&:id))