From: Jay Crouch Date: 2010-01-23T10:02:03+09:00 Subject: --Boundary_(ID_UkgMcKZk3UoGxl7/orOQNA) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Hello, I'm new to ruby/rails and am building out models right now. My question is when extending a has_many attribute of a model as shown below does this cause 2 sequential sql selects, or just one?. Also I am wondering what methods are available on the result... i.e. are all the methods available to has_many available (such as length or clear) to the result of the sub method. class Prospect < ActiveRecord::Base has_many :invitations do def of_campaign(campaign_id) find :all, :conditions => ['campaign_id = ?', campaign_id] end end end #...some controller... AProspect.invitations.of_campaign(1)... #... > I'm pretty sure the above ruby executes: SELECT * FROM invitations WHERE prospect_id = # AND campaign_id = # > But I'm not sure if it also executes SELECT * FROM invitations WHERE prospect_id = # > Also, I'm not clear as to what methods would be available to the result of 'of_campaign'... would all the has_many methods like length and clear be available. Thanks in advance for any help/clarification. Jay Crouch --Boundary_(ID_UkgMcKZk3UoGxl7/orOQNA)--