title: Ransack::Search object was provided to search_form_for
body: <p>I am trying to add a search form on the home page of a web app to search for schools like this; </p>
  
  <pre><code>&lt;%= search_form_for @q, url: schools_path, html: { method: :post, :class =&gt; 'course-finder-form' } do |f| %&gt;                
      &lt;%= f.label :school_name_cont %&gt;
      &lt;%= f.text_field :school_name_cont %&gt;
      &lt;%= f.submit %&gt;                                                                        
  &lt;% end %&gt;&lt;!--//course-finder-form--&gt; 
  </code></pre>
  
  <p>and the schools controller looks like this;</p>
  
  <pre><code>  def index
      @q = School.search(params[:q])
      @schools = @q.result.order("school_name ASC").page(params[:page]).per(50)    
  
      respond_to do |format|
       format.html # index.html.erb
       format.json { render json: @schools }
      end
    end
  </code></pre>
  
  <p>And the rendering controller <strong>home controller</strong></p>
  
  <pre><code>def index
    @q = School.search
  end
  </code></pre>
  
  <p>But on running the app i get this error;</p>
  
  <pre><code>No Ransack::Search object was provided to search_form_for!
  </code></pre>
  
  <p>Any idea how to go about this?</p>