我有一些相关的模型(Rails 2):
class User < ActiveRecord::Base
has_many :proposals, :dependent => :destroy
end
class Proposal < ActiveRecord::Base
belongs_to :user
has_many :proposal_sections, :dependent => :destroy
end
class ProposalSection < ActiveRecord::Base
belongs_to :proposal
end
在操作中,我想返回与用户数据相关的所有内容。我正在使用此查询:
User.find(:first, :conditions => ["id = ?", params[:id]], :include => [:proposals, {:proposals => :proposal_sections}])
此查询是否正确且完整? 谢谢你的回答。