Hi All,
In my new project i am using geocoder gem for finding the
nearest things to a location can i use it for two different models
like i have a volunteer model
and party model
when ever a party created
i should find the volunteers which are near to a party.
--
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.
On Oct 13, 2011, at 3:51 AM, venkata reddy wrote:> Hi All, > In my new project i am using geocoder gem for finding the > nearest things to a location can i use it for two different models > like i have a volunteer model > and party model > when ever a party created > i should find the volunteers which are near to a party. >Can you post what you''ve tried? I was just working on this last night, with great success, so I may be able to help you. Walter -- 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.
The two different models are Party and volunteer.
I have to find all the volunteers who are near to a party.
Here is mycode
Parties#show
def show
@party = Party.find(params[:id])
@volunteers = Volunteer.near(@party.latitude, @party.longitude,
10, :order => :distance)
end
and
show.html.erb in party views
<ul>
<% for volunteer in @volunteers %>
<li><%= link_to volunteer.first_name, volunteer %>
(<%volunteer.distance.round(2) %> miles)</li>
<% end %>
</ul>
But i am getting the following error
undefined method `to_coordinates'' for 17.4359:Float
On Oct 13, 7:32 pm, Walter Lee Davis
<wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org>
wrote:> On Oct 13, 2011, at 3:51 AM, venkata reddy wrote:
>
> > Hi All,
> > In my new project i am using geocoder gem for finding the
> > nearest things to a location can i use it for two different models
> > like i have a volunteer model
> > and party model
> > when ever a party created
> > i should find the volunteers which are near to a party.
>
> Can you post what you''ve tried? I was just working on this last
night, with great success, so I may be able to help you.
>
> Walter
--
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@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Got it it should be @volunteers = Volunteer.near([@party.latitude, @party.longitude], 10, :order => :distance) On Oct 14, 2:35 pm, venkata reddy <venkatareddy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> The two different models are Party and volunteer. > I have to find all the volunteers who are near to a party. > Here is mycode > > Parties#show > def show > @party = Party.find(params[:id]) > @volunteers = Volunteer.near(@party.latitude, @party.longitude, > 10, :order => :distance) > > end > > and > show.html.erb in party views > > <ul> > <% for volunteer in @volunteers %> > <li><%= link_to volunteer.first_name, volunteer %> (<%> volunteer.distance.round(2) %> miles)</li> > <% end %> > </ul> > > But i am getting the following error > > undefined method `to_coordinates'' for 17.4359:Float > > On Oct 13, 7:32 pm, Walter Lee Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote: > > > > > > > > > On Oct 13, 2011, at 3:51 AM, venkata reddy wrote: > > > > Hi All, > > > In my new project i am using geocoder gem for finding the > > > nearest things to a location can i use it for two different models > > > like i have a volunteer model > > > and party model > > > when ever a party created > > > i should find the volunteers which are near to a party. > > > Can you post what you''ve tried? I was just working on this last night, with great success, so I may be able to help you. > > > Walter-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
venkata reddy wrote in post #1026555:> Got it > it should be @volunteers = Volunteer.near([@party.latitude, > @party.longitude], 10, :order => :distance)Thank you, venkata! Very little clear and concise documentation out there and this kind of help is much appreciated! -- 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.