title: Ruby on Rails: Ransack undefined method `result`
body: <p>I'm new to ROR, so this could be a very simple problem.</p>
  
  <p>I have just installed the ransack gem for my web application. I am wanting to search on project names and clients in my database. I have an index page view, which I use for my homepage, then a search page, which uses a search action that I created.</p>
  
  <pre><code>def index
  @projects = Project.all
  
    respond_to do |format|
    format.html # index.html.erb
    format.json { render :json =&gt; @projects }
    end
   end
  
  
  def search
  
    @q = Project.search(params[:q])
    @project_search = @q.result(:distinct =&gt; true)
  
    respond_to do |format|
      format.html # search.html.erb
      format.json { render :json =&gt; @projects }
    end
  end
  </code></pre>
  
  <p>Here is part of my search view:</p>
  
  <pre><code>&lt;%= search_form_for @q do |f| %&gt;
    &lt;%= f.label :project_name %&gt;
    &lt;%= f.text_field :project_name %&gt;
    &lt;%= f.label :client %&gt;
    &lt;%= f.text_field :client %&gt;
    &lt;%= f.submit %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>When I try and load the search page, I get this error:</p>
  
  <p>undefined method `search'</p>
  
  <p>With the extracted source being in my project controller at this line</p>
  
  <pre><code>@q = Project.search(params[:q])
  </code></pre>
  
  <p>Hopefully it's an easy fix, and you can explain what I'm doing wrong so I learn.</p>
  
  <p>Any help at all will be appreciated.</p>
  
  <p>Thanks in advance! </p>
  
  <p>EDIT:
  I've added my index action above to show you that I have an index action, and a search action. Here is my routes.rb file as well.</p>
  
  <pre><code>FinalApp::Application.routes.draw do
  resources :projects
  match "search" =&gt; "projects#search", :as =&gt; :search
  root :to =&gt; 'projects#index'
  end
  </code></pre>
  
  <p>SECOND EDIT:</p>
  
  <p>I hadn't restarted my server. I now have another error.</p>
  
  <p>undefined method `result'</p>
  
  <p>With the extracted source being in my project controller at this line</p>
  
  <pre><code>@project_search = @q.result(:distinct =&gt; true)
  </code></pre>
  
  <p>THIRD EDIT:</p>
  
  <p>Another error :/</p>
  
  <p>undefined method `schema_cache'</p>
  
  <p>With the extracted source being in my project controller at this line</p>
  
  <pre><code>@q = Project.search(params[:q])
  </code></pre>