Class: SearchController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/search_controller.rb

Overview

Searching for posts

Instance Method Summary collapse

Instance Method Details

#indexObject

get /search?q=



6
7
8
9
# File 'app/controllers/search_controller.rb', line 6

def index
  q = param_from_request(:q).to_s[0..100]
  @collection = q.blank? ? [] : Post.pg_search(q).page_for_visitors(current_page)
end