I''m currently using the GeoKit plugin for a Rails web application
I''m
building, and I''m having a problem with the "find all locations
within
a distance from this location" aspect of it.
I have a browse form, which takes a distance, and a zipcode, and
returns all locations that fit. However, it seems to only be returning
the first location for each zipcode it finds.
For example, I have 5 locations:
Loc1 - 02110
Loc2 - 02110
Loc3 - 02360
Loc4 - 02110
Loc5 - 02360
The search function only returns two results, Loc1 and Loc3. My search
function in the controller looks like this:
def search
if params[:zip]
@location = Location.find(:all, :origin =>
params[:zip], :within => params[:miles]
@location = @location.sort_by { |location| location.name }
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
I hit enter and cut my search function off.
def search
if params[:zip]
@location = Location.find(:all, :origin =>
params[:zip], :within => params[:miles]
@location = @location.sort_by { |location| location.name }
@pages, @location = paginate(@location)
end
end
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Never Mind, I''m an idiot, I forgot that the first 2/3 of my test data was inputting before I had geomapping working correctly, so there wasn''t any lat/lng to test against. case closed! On Jan 7, 12:12 pm, naevity <jonathan.mulc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I hit enter and cut my search function off. > > def search > if params[:zip] > @location = Location.find(:all, :origin => > params[:zip], :within => params[:miles] > @location = @location.sort_by { |location| location.name } > @pages, @location = paginate(@location) > end > end--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---