Skip to content

Instantly share code, notes, and snippets.

@tpitale
Created May 20, 2009 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tpitale/114839 to your computer and use it in GitHub Desktop.
Save tpitale/114839 to your computer and use it in GitHub Desktop.
class Search
include DataMapper::Resource
property :id, Serial
end
class Result
include DataMapper::Resource
property :id, Serial
belongs_to :search
end
Result.all.each do |r|
puts r.search.inspect
end
# below happens on every iteration of results
SELECT `id` FROM `searches` WHERE (`id` IN (19, 33, 31, 32, 29, 64, 69, 37, 88, 71, 72, 43, 74, 45, 39, 116, 83, 51, 52, 55, 59, 79, 61, 85, 99, 81, 62, 89, 30, 84, 47, 90, 102, 91, 94, 131, 36, 133, 104, 68, 106, 108, 141, 142, 107, 118, 121, 110, 147, 111, 117, 123, 122, 139, 145, 135, 130, 132, 137, 138, 144, 155, 67, 140, 172, 157, 42, 160, 46, 58, 156, 168, 173, 175, 164, 60, 5, 18)) ORDER BY `id`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment