所以,我接下来的4种型号:如何使查找回报率与递归查询像CakePHP的
class Payment < ActiveRecord::Base
has_many :orders
end
class Order < ActiveRecord::Base
has_many :folders
belongs_to :payment
end
class Folder < ActiveRecord::Base
has_many :documents
belongs_to :order
end
class Document < ActiveRecord::Base
belongs_to :folder
end
怎样才能使一个支付的查找和检索所有与该付款订单以及这些订单的所有文件夹以及这些文件夹的所有文件。在CakePHP设置参数递归是足够的,但在RoR我不知道该怎么做,我必须使用宝石?或者有其他名字?
你试过'Payment.find(ID).orders' – Cyzanfar
呀Cyzanfar我已经尝试,但只找回订单我想要所有的付款与订单和文件夹和文件。 –