0
我有3个型号:作家,书,页。导轨访问所有has_many通过记录
Writer has_many :books
Writer has_many :pages, through: :books
Book has_many :pages
我想显示所有属于通过这本书作家的页面,但它给出了一个错误:
Writer.first.books #=> works, shows all writer books
Book.first.pages #=> works, shows all book pages
Writer.first.books.pages #=> does not work, must in theory display all pages that belong to the writer
什么是显示所有网页的最佳方式,使用each do |x|
除外?