Skip to content

Commit

Permalink
further optimization re: #82
Browse files Browse the repository at this point in the history
  • Loading branch information
jywarren committed Mar 2, 2015
1 parent 394a6bf commit a7c7d5b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/controllers/spectrums_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ def compare
# non REST
def search
params[:id] = params[:q].to_s if params[:id].nil?
@spectrums = Spectrum.find(:all, :conditions => ['title LIKE ? OR notes LIKE ?',"%"+params[:id]+"%", "%"+params[:id]+"%"],:limit => 100, :order => "id DESC")
@spectrums = Spectrum.where('title LIKE ? OR notes LIKE ?',"%"+params[:id]+"%", "%"+params[:id]+"%").order("id DESC").paginate(:page => params[:page])
@spectrums = @spectrums.paginate :page => params[:page], :per_page => 24
if params[:capture]
render :partial => "capture/results", :layout => false
else
@sets = SpectraSet.find(:all, :conditions => ['title LIKE ? OR notes LIKE ?',"%"+params[:id]+"%", "%"+params[:id]+"%"],:limit => 100, :order => "id DESC")
@sets = SpectraSet.where('title LIKE ? OR notes LIKE ?',"%"+params[:id]+"%", "%"+params[:id]+"%").order("id DESC").paginate(:page => params[:set_page])
end
end

Expand Down
2 changes: 2 additions & 0 deletions app/views/spectrums/search.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
<hr />
<h3>Related sets</h3>
<%= render :partial => 'sets' %>
<%= will_paginate @sets, :param_name => :set_page, renderer: BootstrapPagination::Rails %>
</div>

<div class="span8">
<%= render :partial => 'list' %>
<%= will_paginate @spectrums, renderer: BootstrapPagination::Rails %>
</div>
</div>
</div>

0 comments on commit a7c7d5b

Please sign in to comment.