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

Reply via email to