title: Ruby on Rails 4: Searchkick displaying all items instead of searched results
body: <p>I have a <code>Forum</code> that <code>has_many</code> <code>:forum_threads</code> and <code>has_many :forum_posts, through: :forum_threads</code>. So basically my Forums have their own Forum Threads that are related to that particular Forum topic. I've added Searchkick to handle the search form. Searchkick is working for my <code>Forum</code> table but not for my <code>ForumThread</code> table. </p>
  
  <p>There is no error, it just renders out all of the forum threads instead of rendering the query that the form was given.</p>
  
  <p><a href="https://github.com/ankane/searchkick" rel="nofollow">Searchkick GitHub</a></p>
  
  <p>Here are my files:</p>
  
  <p><strong>forum.rb</strong></p>
  
  <pre><code>class Forum &lt; ActiveRecord::Base
  
   accepts_nested_attributes_for :forum_threads
   has_many :forum_posts, through: :forum_threads
   accepts_nested_attributes_for :forum_posts
  
   searchkick text_start: [:title], suggest: [:title], autocomplete: [:title]
  
      def search_data         
              {
                  title: title                    
              }
      end
  
  end
  </code></pre>
  
  <p><strong>forums_controller.rb</strong></p>
  
  <pre><code>class ForumsController &lt; ApplicationController
  
   def index
      query = params[:q] || "*"
      @forums = Forum.search(query, suggest: true, fields: [:title],
                          boost_where: {specific: :exact})
   end
  
  end
  </code></pre>
  
  <p><strong>views/forums/index.html.erb</strong></p>
  
  <pre><code>&lt;%= form_tag forums_path, method: :get do |f| %&gt;
    &lt;%= text_field_tag :q, nil, class: 'form-control', placeholder: 'Search...' %&gt;
  &lt;% end %&gt;
  
    &lt;% if @forums.suggestions.any? %&gt;
      &lt;p class="lead"&gt;
          &lt;em&gt;Did you mean: &lt;strong&gt;&lt;%= @forums.suggestions.first %&gt;&lt;/strong&gt;?&lt;/em&gt;
      &lt;/p&gt;
    &lt;% end %&gt;
  </code></pre>
  
  <p><strong>forum_thread.rb</strong></p>
  
  <pre><code>class ForumThread &lt; ActiveRecord::Base
  
   belongs_to :user, counter_cache: true
   belongs_to :forum, counter_cache: true, touch: true
   has_many :forum_posts, dependent: :destroy
   accepts_nested_attributes_for :forum_posts
  
   validates :subject, presence: true
   validates_associated :forum_posts
  
   searchkick text_start: [:subject], suggest: [:subject], autocomplete: [:subject]
  
      def search_data         
              {   
                  subject: subject,   
                  description: description                            
              }
      end
  
  end
  </code></pre>
  
  <p><strong>forum_threads_controller.rb</strong></p>
  
  <pre><code>class ForumsController &lt; ApplicationController
  
   def index
      query = params[:q].presence || "*"
          @forum_threads = @forum.forum_threads.search(query, suggest: true, fields: [:subject, :description])
   end
  
  end
  </code></pre>
  
  <p><strong>views/forum_threads/index.html.erb</strong></p>
  
  <pre><code>&lt;%= form_tag forum_forum_threads_path(&lt;!-- something here? --&gt;), method: :get do %&gt;
      &lt;%= text_field_tag :q, nil, class: 'form-control', placeholder: 'Search...' %&gt;
  &lt;% end %&gt;
  
  
   &lt;% if @forum_threads.suggestions.any? %&gt;
      &lt;p class="lead"&gt;&lt;em&gt;Did you mean: &lt;%= @forum_threads.suggestions.first %&gt;?&lt;/em&gt;&lt;/p&gt;
   &lt;% end %&gt;
  </code></pre>
  
  <p><strong>routes.rb</strong></p>
  
  <pre><code>Rails.application.routes.draw do
  
   resources :forums do
    resources :forum_threads do
      resources :forum_posts do
        member do
          put 'like', to: 'forum_posts#upvote'
          put 'dislike', to: 'forum_posts#downvote'
        end 
       end
      end
     end
  
  end
  </code></pre>