Hi,
I am using Geokit, but I can’t seem to properly limit the number of rows
returned by GeoKit
when I do something like this:
Thing.find(:all, :origin => [@home_city.lat, @home_city.lng], :within =>
10, :limit => 20)
Thing, actually doesn’t have acts_as_mappable set on itself, because
Thing has a ‘Venue’ relation and it’s that Venue which contains the lat
and the long. So here is the model for Thing:
belongs_to :venue
acts_as_mappable :through => :venue
And here is Venue:
has_many :things
acts_as_mappable
But what I think the find command is doing is setting the limit on the
number of VENUES found, not the total number of THINGs found. Because a
Venue may have more than one thing, this means I have trouble building
efficient queries and limiting the records returned. There’s no join
table involved, even though I’m using :through, and this confuses me a
little, but I’m assuming that acts_as_mappable just absorbs that up.
Any advice on how to fix this little setup? I notice that my has_many
and belongs_to are reversed compared to the Geokit example for :through
relations… :-/
Thanks for any help offered!
- N
(Disclosure; I posted a similar question to the GeoKit list yesterday
but no response, so I thought I’d cast a wider net).