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
=> []
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.