Class: SearchController

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

Instance Method Summary collapse

Instance Method Details

#indexObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/search_controller.rb', line 4

def index
  @results = []
  if params[:phrase].blank?
    return
  end
  @pages = []
  @posts = []
  begin
    @pages = SpudPage.find_with_index(params[:phrase])
  rescue
  end

  begin
    @posts = SpudPost.find_with_index(params[:phrase])
  rescue
    
  end

  @results += @pages
  @results += @posts
  
  @results = @results.paginate :page => params[:page]
end