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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedSep 27, '11 at 7:16a
activeSep 27, '11 at 7:16a
posts1
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Artūras Šlajus: 1 post

People

Translate

site design / logo © 2021 Grokbase