Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SearchesController < ApplicationController
- def perform
- @criteria = params[:criteria]
- @simple_header = "Search result for #{@criteria}. "
- respond_to do |format|
- format.js do
- @tab_name = params[:tab]
- if @tab_name == "popular"
- @vectors = Vector.full_search(params[:criteria], :order => :popularity).page(params[:page]).per(Vector::PER_PAGE)
- else
- @vectors = Vector.full_search(params[:criteria], :order => :created_at).page(params[:page]).per(Vector::PER_PAGE)
- end
- @simple_header = "Search result for #{@criteria}. #{@vectors.total_count} vectors found."
- render "shared/vectors_list"
- end
- format.html do
- @vectors = Vector.full_search(params[:criteria], :order => :created_at).page(params[:page]).per(Vector::PER_PAGE)
- @popular_vectors = Vector.full_search(params[:criteria], :order => :popularity).page(params[:page]).per(Vector::PER_PAGE)
- @simple_header = "Search result for #{@criteria}. #{@vectors.total_count} vectors found."
- render "shared/vectors_list"
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement