Skip to content

Instantly share code, notes, and snippets.

@leemcalilly
Created January 23, 2012 20:26
Show Gist options
  • Save leemcalilly/1665371 to your computer and use it in GitHub Desktop.
Save leemcalilly/1665371 to your computer and use it in GitHub Desktop.
index.html.erb
<div id="search_results">
<%- if @results.empty? %>
<p>Sorry - there were no results for "<strong><%= params[:search] %></strong>".</p>
<p><%= link_to "Return to your homepage", root_path %>.</p>
<%- end %>
<% @results.each do |result| %>
<% if result.kind_of?(PartnerPage) %>
<h2><%= link_to result.title, partner_path(result) %></h2>
<% else %>
<h2><%= link_to result.title, polymorphic_path(result) %></h2>
<% end %>
<p><%= truncate(strip_tags(result.description), :length => 500).html_safe %></p>
<% end %>
</div>
<%= paginate @results, :params => { :search => params[:search] } %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment