Module: SearchBehaviour

Included in:
LabSearchesController, SearchesController
Defined in:
app/models/search_behaviour.rb

Constant Summary collapse

MINIMUM_QUERY_LENGTH =
3

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object


4
5
6
# File 'app/models/search_behaviour.rb', line 4

def self.included(base)
  base.helper_method :each_non_empty_search_result
end

Instance Method Details

#searchObject


8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/models/search_behaviour.rb', line 8

def search
  t = Time.now
  @query = params[:q]
  perform_search(params[:q].strip) unless params[:q].blank? || query_invalid?
  @search_took = Time.now - t
  @render_start = Time.now

  respond_to do |format|
    format.html
    format.js { render partial: 'search', layout: false }
  end
end