When I run rake ts: rebuild I am getting this error `undefined method 
`active_record' for #<ActiveRecord::Associations::JoinDependency`

The full error:

undefined method `active_record' for 
> #<ActiveRecord::Associations::JoinDependency:0x007fad256f8ae0>
> /.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/associations.rb:66:in
>  
> `reflection_for'
> /.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/associations.rb:44:in
>  
> `join_for'
> /.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/associations.rb:28:in
>  
> `alias_for'
> /.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/property_sql_presenter.rb:44:in
>  
> `column_with_table'
> /.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/property_sql_presenter.rb:49:in
>  
> `block in columns_with_table'
> /.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/property_sql_presenter.rb:48:in
>  
> `collect'
> /.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/property_sql_presenter.rb:48:in
>  
> `columns_with_table'
> /.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/property_sql_presenter.rb:31:in
>  
> `casted_column_with_table'
> /.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/property_sql_presenter.rb:15:in
>  
> `to_select'
> /.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/sql_builder.rb:122:in
>  
> `collect'
> /.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/sql_builder.rb:122:in
>  
> `select_clause'
> /.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/sql_builder.rb:10:in
>  
> `sql_query'
> /.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/sql_source.rb:110:in
>  
> `prepare_for_render'
> /.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/sql_source.rb:61:in
>  
> `render'
> /.rvm/gems/ruby-2.0.0-p0/gems/riddle-1.5.8/lib/riddle/configuration/index.rb:29:in
>  
> `block in render'
> /.rvm/gems/ruby-2.0.0-p0/gems/riddle-1.5.8/lib/riddle/configuration/index.rb:29:in
>  
> `collect'
> /.rvm/gems/ruby-2.0.0-p0/gems/riddle-1.5.8/lib/riddle/configuration/index.rb:29:in
>  
> `render'
> /.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/core/index.rb:48:in
>  
> `render'
> /.rvm/gems/ruby-2.0.0-p0/gems/riddle-1.5.8/lib/riddle/configuration.rb:39:in 
> `block in render'
> /.rvm/gems/ruby-2.0.0-p0/gems/riddle-1.5.8/lib/riddle/configuration.rb:39:in 
> `collect'
> /.rvm/gems/ruby-2.0.0-p0/gems/riddle-1.5.8/lib/riddle/configuration.rb:39:in 
> `render'
> /.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/configuration.rb:81:in
>  
> `render'
> /.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/configuration.rb:87:in
>  
> `block in render_to_file'
> /.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/configuration.rb:87:in
>  
> `render_to_file'
> /.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/rake_interface.rb:4:in
>  
> `configure'
> /.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/rake_interface.rb:31:in
>  
> `index'
> /.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/tasks.rb:9:in
>  
> `block (2 levels) in <top (required)>'
> /.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `eval'
> /.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `<main>'
> Tasks: TOP => ts:rebuild => ts:index


Here's my index file:

ThinkingSphinx::Index.define :user, :with => :active_record do
>   # fields
>   indexes name, :as => :user, :sortable => true
>   indexes religion, zip_code, about_me, career, sexuality, children, 
> user_smoke, user_drink, age, gender, ethnicity, education, username
>   indexes user.location, :as => :user_location
> # attributes
>   has created_at, updated_at
>   
>   has zip_code
>   has "RADIANS(user.location.latitude)",  :as => :latitude,  :type => 
> :float
>   has "RADIANS(user.location.longitude)", :as => :longitude, :type => 
> :float
>       set_property :latitude_attr => :latitude, :longitude_attr => 
> :longitude
> end



I'm thinking my user and location model could be causing the issue.

User.rb:

  belongs_to :zip_code, foreign_key: "user_id"


Location.rb:

has_many :users


Any idea why I am getting this error? If someone could help 

-- 
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