title: rake ts:configure rake ts:index thinking-sphinx-3.1.1 ruby-2.0.0 error
body: <p>I am trying to configure a rails running application on my localhost. I have not used sphinx before. I have installed the sphinx-search on my Ubuntu machine and its service is running.</p>
  
  <p>When i try to execute rake ts:index or rake ts:configure I get the following error:</p>
  
  <pre><code>NoMethodError: undefined method `klass' for nil:NilClass
  </code></pre>
  
  <p>Here is the full stack trace:</p>
  
  <pre><code>rake ts:configure --trace
  ** Invoke ts:configure (first_time)
  ** Invoke environment (first_time)
  ** Execute environment
  ** Execute ts:configure
  Generating configuration to /home/baran/code/atdhe/config/development.sphinx.conf
  rake aborted!
  NoMethodError: undefined method `klass' for nil:NilClass
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib        
  
  /thinking_sphinx/active_record/attribute/type.rb:37:in `block in associations'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib    
  /thinking_sphinx/active_record/attribute/type.rb:35:in `collect'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib                    /thinking_sphinx/active_record/attribute/type.rb:35:in `associations'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/active_record/attribute/type.rb:62:in `multi_from_associations'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib    /thinking_sphinx/active_record/attribute/type.rb:9:in `multi?'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/active_record/attribute.rb:4:in `multi?'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb:18:in `collection_type'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/active_record/sql_source.rb:96:in `block in append_presenter_to_attribute_array'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/active_record/sql_source.rb:93:in `each'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/active_record/sql_source.rb:93:in `append_presenter_to_attribute_array'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/active_record/sql_source.rb:132:in `prepare_for_render'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/active_record/sql_source.rb:65:in `render'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/riddle-1.5.11/lib/riddle/configuration/index.rb:29:in `block in render'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/riddle-1.5.11/lib/riddle/configuration/index.rb:29:in `collect'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/riddle-1.5.11/lib/riddle/configuration/index.rb:29:in `render'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/core/index.rb:53:in `render'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/riddle-1.5.11/lib/riddle/configuration.rb:43:in `block in render'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/riddle-1.5.11/lib/riddle/configuration.rb:43:in `collect'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/riddle-1.5.11/lib/riddle/configuration.rb:43:in `render'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/configuration.rb:90:in `render'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/configuration.rb:96:in `block in render_to_file'
  /home/baran/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/open-uri.rb:36:in `open'
  /home/baran/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/open-uri.rb:36:in `open'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/configuration.rb:96:in `render_to_file'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/rake_interface.rb:13:in `configure'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/tasks.rb:4:in `block (2 levels) in &lt;top (required)&gt;'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/task.rb:240:in `call'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/task.rb:240:in `block in execute'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/task.rb:235:in `each'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/task.rb:235:in `execute'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
  /home/baran/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/task.rb:165:in `invoke'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/application.rb:150:in `invoke_task'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/application.rb:106:in `each'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/application.rb:106:in `block in top_level'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/application.rb:115:in `run_with_threads'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/application.rb:100:in `top_level'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/application.rb:78:in `block in run'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/bin/rake:33:in `&lt;top (required)&gt;'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/bin/rake:23:in `load'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/bin/rake:23:in `&lt;main&gt;'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/bin/ruby_executable_hooks:15:in `eval'
  /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/bin/ruby_executable_hooks:15:in `&lt;main&gt;'
  Tasks: TOP =&gt; ts:configure
  </code></pre>
  
  <p>Here are the indices files:</p>
  
  <pre><code>ThinkingSphinx::Index.define :restaurant, :with =&gt; :active_record, :delta =&gt;    ThinkingSphinx::Deltas::DelayedDelta do
  
    indexes school(:school_name), :sortable =&gt; true, :as =&gt; :school_name
    indexes school(:branch_name), :sortable =&gt; true, :as =&gt; :branch_name
    indexes school(:delta) =&gt; ThinkingSphinx::Deltas::DelayedDelta
    has restaurant_info(:is_pick_up), :as =&gt; :pick_up, :facet =&gt; true
    has delivery_info(:is_delivery),  :as =&gt; :delivery, :facet =&gt; true
  
    indexes contact_info(:restaurant_name), :sortable =&gt; true
  
    indexes delivery_info(:delivery_charges), :as =&gt; :delivery_charges
  
    has school(:id), :as =&gt; :school_id, :facet =&gt; true
  
    has restaurant_categories(:id), :as =&gt; :restaurant_category_ids, :facet =&gt; true
  
    has restaurant_info(:min_order), :as =&gt; :min_order, :type =&gt; :float, :sortable =&gt; true
  
    has avg_rating, :as =&gt; :rating, :type =&gt; :integer, :sortable =&gt; true
    has ranking, :as =&gt; :ranking, :type =&gt; :integer, :sortable =&gt; true
  
    has delivery_info(:delivery_estimated_time), :as =&gt; :delivery_eta, :type =&gt; :integer, :sortable =&gt; true
  
        set_property :min_infix_len =&gt; 1
    set_property :delta =&gt; ThinkingSphinx::Deltas::DelayedDelta
  end
  
  
  ThinkingSphinx::Index.define :school, :with =&gt; :active_record, :delta =&gt;         ThinkingSphinx::Deltas::DelayedDelta do
    indexes :school_name, :sortable =&gt; true, :as =&gt; :school_name
    indexes buildings(:building_name), :sortable =&gt; true
    set_property :min_infix_len =&gt; 1
    set_property :delta =&gt; ThinkingSphinx::Deltas::DelayedDelta
  end
  </code></pre>