title: How to make a search results page with pg_search multisearch that has links to the results?
body: <p>I finally figured out how to implement pg_search's multisearch feature.  But I'm having trouble making a usable search results page that displays links back to the various articles and faqs that contain the search terms.  It's a pretty basic setup using Rails 3.2.3:</p>
  
  <p><strong>Models:</strong></p>
  
  <p>I have an Articles and a Faqs model, both with "Title" and "Content" attributes, and this code in both models:</p>
  
  <pre><code>include PgSearch
  multisearchable :against =&gt; [:title, :content]
  </code></pre>
  
  <p><strong>Search Form View Code:</strong></p>
  
  <p>The search form passes everything to a controller called "results."</p>
  
  <pre><code>&lt;%= form_tag result_index_path, method: :get do %&gt;
    &lt;%= text_field_tag :query, params[:query] %&gt;
    &lt;%= submit_tag "GO", name: nil %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p><strong>Results Controller:</strong></p>
  
  <pre><code>class ResultController &lt; ApplicationController
    def index
       @pg_search_documents = PgSearch.multisearch(params[:query])
    end
  end
  </code></pre>
  
  <p>I would like to make a search results page that displays the title of each result found, with a link back to that item.  I figured out how to pull the 'class' attribute out @pg_search_documents.  My thinking is to do something like this on the results page:</p>
  
  <pre><code>&lt;ul&gt;
  &lt;% @pg_search_documents.each do |pg_search_document| %&gt;
    &lt;li&gt;&lt;%= link_to pg_search_document.searchable.title, "../#{pg_search_document.searchable.class}/#{pg_search_document.searchable.id}" %&gt;&lt;/li&gt;
  &lt;% end %&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>An example link that this code yields is: <code>http://localhost/Article/3</code>.  If I could figure out how to downcase and pluralize "pg_search_document.searchable.class", I'd be home free.  I've tried writing various methods in the model and controller, and tried writing a helper.  But this is where my Rails skills fail me.</p>
  
  <p>Any suggestions?  Anybody know of a more elegant way of accomplishing this?  Any ideas / suggestions are very much appreciated.</p>