Is it supposed to do that? I find it very confusing.
AR 3.0.10
class Unit has_many :units, :finder_sql => proc { "SELECT * FROM `#{table_name}` WHERE `location_id`=#{id} AND `location_type`=#{Location::UNIT}" } end
Both should return . However...
Unit.first.units.find([1000000])
[2011-09-27 10:05:11|main|debug] Unit Load (4.0ms) SELECT `units`.* FROM `units` LIMIT 1 [2011-09-27 10:05:11|main|debug] Unit Load (3.0ms) SELECT * FROM `units` WHERE `location_id`=1 AND `location_type`=3 => [nil]
Unit.first.units.find([1000000, 10])
[2011-09-27 10:05:19|main|debug] Unit Load (7.0ms) SELECT `units`.* FROM `units` LIMIT 1 [2011-09-27 10:05:19|main|debug] Unit Load (2.0ms) SELECT * FROM `units` WHERE `location_id`=1 AND `location_type`=3 =>