title: Sunpot search not searching. "rake sunspot:solr:reindex" aborted
body: <p>I'm attempting to use Sunspot/Solr to search all User name and content associated with their profile (named 'bio'). The search box is at <code>http://localhost:3000/users</code>. I'm clearly not doing something right because when i search a name i get taken back to page 1 of Users with the full list i.e no search has been executed. I'm stumped. </p>
  
  <p>When i run <code>rake sunspot:solr:reindex</code></p>
  
  <pre><code>undefined method `title' for #&lt;User:0x007f9e9ea52e60&gt;
          /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/activemodel-4.0.0/lib/active_model/attribute_methods.rb:436:in `method_missing'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/activerecord-4.0.0/lib/active_record/attribute_methods.rb:131:in `method_missing'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot-2.0.0/lib/sunspot/data_extractor.rb:17:in `value_for'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot-2.0.0/lib/sunspot/field_factory.rb:58:in `populate_document'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot-2.0.0/lib/sunspot/indexer.rb:100:in `block in prepare'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot-2.0.0/lib/sunspot/indexer.rb:99:in `each'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot-2.0.0/lib/sunspot/indexer.rb:99:in `prepare'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot-2.0.0/lib/sunspot/indexer.rb:26:in `block in add'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot-2.0.0/lib/sunspot/indexer.rb:26:in `map'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot-2.0.0/lib/sunspot/indexer.rb:26:in `add'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot-2.0.0/lib/sunspot/session.rb:91:in `index'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot-2.0.0/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `index'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot-2.0.0/lib/sunspot/session_proxy/retry_5xx_session_proxy.rb:17:in `method_missing'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot-2.0.0/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `index'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot-2.0.0/lib/sunspot.rb:184:in `index'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot_rails-2.0.0/lib/sunspot/rails/searchable.rb:261:in `block (2 levels) in solr_index'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot_rails-2.0.0/lib/sunspot/rails/searchable.rb:365:in `solr_benchmark'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot_rails-2.0.0/lib/sunspot/rails/searchable.rb:260:in `block in solr_index'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/activerecord-4.0.0/lib/active_record/relation/batches.rb:75:in `find_in_batches'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/activerecord-deprecated_finders-1.0.3/lib/active_record/deprecated_finders/relation.rb:70:in `find_in_batches'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/activerecord-deprecated_finders-1.0.3/lib/active_record/deprecated_finders/relation.rb:68:in `find_in_batches'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/activerecord-4.0.0/lib/active_record/querying.rb:8:in `find_in_batches'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot_rails-2.0.0/lib/sunspot/rails/searchable.rb:259:in `solr_index'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot_rails-2.0.0/lib/sunspot/rails/searchable.rb:203:in `solr_reindex'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot_rails-2.0.0/lib/sunspot/rails/tasks.rb:64:in `block (3 levels) in &lt;top (required)&gt;'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot-2.0.0/lib/sunspot/class_set.rb:16:in `each'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot-2.0.0/lib/sunspot/class_set.rb:16:in `each'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/sunspot_rails-2.0.0/lib/sunspot/rails/tasks.rb:63:in `block (2 levels) in &lt;top (required)&gt;'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/bin/ruby_noexec_wrapper:14:in `eval'
      /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/bin/ruby_noexec_wrapper:14:in `&lt;main&gt;'
      Tasks: TOP =&gt; sunspot:solr:reindex =&gt; sunspot:reindex
      (See full trace by running task with --trace)
  </code></pre>
  
  <p><strong>model/bio.rb</strong></p>
  
  <pre><code>class User &lt; ActiveRecord::Base
  
      searchable do
    text :title, :name, :content, :body
    end
  
  
  end
  </code></pre>
  
  <p><strong>bio_controllers.rb (this is a separate file from user_controller.rb)</strong></p>
  
  <pre><code>class BioController &lt; ApplicationController
  
  def index
  
    @search = users.search do
      fulltext params[:search] 
    end
  
    @users = @search.results
  end
  </code></pre>
  
  <p><strong>index.html.erb</strong></p>
  
  <pre><code> &lt;% provide(:title, 'All users') %&gt;
  
      &lt;%= form_tag users_path, :method =&gt; :get do %&gt;
  
        &lt;p&gt;
          &lt;%= text_field_tag :search, params[:search] %&gt;
          &lt;%= submit_tag "Search", :name =&gt; nil %&gt;
        &lt;/p&gt;
      &lt;% end %&gt;
  
  
      &lt;h1&gt;All users&lt;/h1&gt;
  
      &lt;%= will_paginate %&gt;
  
      &lt;ul class="users"&gt;
        &lt;%= render @users %&gt;
      &lt;/ul&gt;
  
      &lt;%= will_paginate %&gt;
  </code></pre>
  
  <p><strong>db/migrate/...</strong></p>
  
  <pre><code>class AddBioToUserProfile &lt; ActiveRecord::Migration
    def change
      add_column :users, :bio, :string
    end
  end
  </code></pre>
  
  <p><strong>User.rb</strong></p>
  
  <pre><code>class User &lt; ActiveRecord::Base
  
    searchable do
    text :name, :bio, :users
    end
  
  
    before_save { self.email = email.downcase }
    before_create :create_remember_token
  
    validates :name, presence: true, length: { maximum: 50 }
    #VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
    validates :email, presence:   true,
                      #format:     { with: VALID_EMAIL_REGEX },
                      uniqueness: { case_sensitive: false }
    has_secure_password
    validates :password, length: { minimum: 6 }
  
    def User.new_remember_token
      SecureRandom.urlsafe_base64
    end
  
    def User.encrypt(token)
      Digest::SHA1.hexdigest(token.to_s)
    end
  
    private
  
      def create_remember_token
        self.remember_token = User.encrypt(User.new_remember_token)
      end
  
  
  
  end
  </code></pre>