I have some associated models (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
In action I want to return all associated with User data. I'm using this query:
User.find(:first, :conditions => ["id = ?", params[:id]], :include => [:proposals, {:proposals => :proposal_sections}])
Is this query correct and complete ? Thank You for answers.