【发布时间】:2025-04-29 05:00:02
【问题描述】:
所以在rails中,我有
class Organization < ActiveRecord::Base
has_many :boxes
class Box < ActiveRecord::Base
has_many :items
belongs_to :organization
class Item < ActiveRecord::Base
belongs_to :box
如果不添加组织上的关联,如何查询属于组织的所有项目?我不想在 Item 中添加 orgaization_id。
【问题讨论】:
标签: sql ruby-on-rails arel