I did the has and belongs to since what I was using before didn't seem to 
work. I now changed it back to `belongs_to :locations`. Regardless with 
your code the new error I get is…`uuninitialized constant User::Locations`

You can view the full error at https://gist.github.com/anonymous/7604060

BTW previously before I came here I was also trying this:

ThinkingSphinx::Index.define :user, :with => :active_record do
>   # fields
>   indexes name
>   # attributes
>   has created_at, updated_at
>   has location.city, :as => :location_city
>   has "RADIANS(locations.latitude)",  :as => :latitude,  :type => :float
>   has "RADIANS(locations.longitude)", :as => :longitude, :type => :float
> end



With your assistance. This is how all my code looks now:

ThinkingSphinx::Index.define :location, :with => :active_record do 
>   indexes city 
>   
>   has "RADIANS(locations.latitude)",  :as => :latitude,  :type => :float
>   has "RADIANS(locations.longitude)", :as => :longitude, :type => :float
> end
> ThinkingSphinx::Index.define :user, :with => :active_record do 
>   indexes name, :as => :user, :sortable => true 
>   indexes religion, zip_code, about_me, career, sexuality, children, 
> user_smoke, user_drink, gender, ethnicity, education 
>   has created_at, updated_at 
>   has locations.ids, :as => :locations_ids 
> end 
>  


user.rb:

>   belongs_to :location
>   attr_accessible :name


location.rb:

> class Location < ActiveRecord::Base  
>   attr_accessible :city, :latitude, :longitude, :zipcode
> end

 
Distance controller:

> class DistanceController < ApplicationController
>   def search
>     @latitude = params[:latitude].to_f * Math::PI / 180
>     @longitude = params[:longitude].to_f * Math::PI / 180
>     @users = User.search :geo => [@latitude, @longitude], :with => 
> {:geodist => 0.0..200_000.0}, :order => "geodist ASC"
>   end
>   end

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to