public
Description: Tog Platform Core
Homepage: http://www.toghq.com
Clone URL: git://github.com/tog/tog_core.git
tog_core / app / helpers / search_helper.rb
100644 14 lines (12 sloc) 0.485 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module SearchHelper
  
  def render_match_partial(match)
    begin
      klass = match.class.name.underscore
      render :partial => "search/#{klass}", :locals => { :match => match }
    rescue ActionView::MissingTemplate => e
      "Missing search template for model #{klass}. Create a search/_#{klass}.html.erb partial in the correct plugin and try again."
    rescue RuntimeError => e
      "Unable to find the class name of the following match #{debug match}"
    end
  end
  
end