2

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.

Anthony Alberto
  • 10,325
  • 3
  • 34
  • 38
Leszek Andrukanis
  • 2,114
  • 2
  • 19
  • 30

0 Answers0