Friday, April 9, 2010

ordering of includes.

When an active record has 2 belongs_to lines pointing to the same table the searching fails... notice the ordering of the includes.



(rdb:1)  Customer.find(:all, :conditions => ["#{Address.table_name}.name_given = 'kdFJf6J6Mdx'"], :include => [:address, :shipping_address] )
[]
(rdb:1)  Customer.find(:all, :conditions => ["#{Address.table_name}.name_given = 'kdFJf6J6Mdx'"], :include => [:shipping_address, :address] )
[#<Customer id: 81, ...SNIP... >]

No comments:

Post a Comment