app/helpers/searches_helper.rb
# Return the partial (including path) for the given object.
# partial can also accept an array of objects (of the same type).
Return the partial (including path) for the given object.
partial can also accept an array of objects (of the same type).
Return the partial ( including path ) for the given object . partial can also accept an array of objects ( of the same type ) .
def partial(object)
    object = object.first if object.is_a?(Array)
    klass = object.class.to_s
    case klass
    when "ForumPost"
      dir  = "topics" 
      part = "search_result"
    when "AllUser"
      dir  = 'users'
      part = 'user'
    else
      dir  = klass.tableize  
      part = dir.singularize 
    end
    admin_search? ? "admin/#{dir}/#{part}" : "#{dir}/#{part}"
  end
def partial ( object ) object = object . first if object . is_a? ( Array ) klass = object . class . to_s case klass when "ForumPost" dir = "topics" part = "search_result" when "AllUser" dir = 'users' part = 'user' else dir = klass . tableize part = dir . singularize end admin_search? ? "admin/#{dir}/#{part}" : "#{dir}/#{part}" end
Return the partial (including path) for the given object.
Return the partial ( including path ) for the given object .
# E.g., 'Person' becomes 'people' # E.g., 'people' becomes 'person'
object
<not_specific>