This commit is contained in:
albert
2013-02-23 13:27:18 -05:00
parent 3c1176b077
commit 096f1be22b
4 changed files with 11 additions and 12 deletions

View File

@@ -8,8 +8,7 @@ class TagsController < ApplicationController
end
def index
@search = Tag.search(params[:search])
@tags = @search.paginate(params[:page])
@tags = Tag.search(params[:search]).paginate(params[:page])
respond_with(@tags)
end

View File

@@ -228,7 +228,7 @@ class Artist < ActiveRecord::Base
def search(params)
q = active
return q if params.blank?
params = {} if params.blank?
case params[:name]
when /^http/

View File

@@ -403,7 +403,7 @@ class Tag < ActiveRecord::Base
def search(params)
q = scoped
return q if params.blank?
params = {} if params.blank?
if params[:name_matches].present?
q = q.name_matches(params[:name_matches])
@@ -413,7 +413,7 @@ class Tag < ActiveRecord::Base
q = q.where("category = ?", params[:category])
end
if params[:hide_empty] != "no"
if params[:hide_empty].blank? || params[:hide_empty] != "no"
q = q.where("post_count > 0")
end
@@ -422,22 +422,22 @@ class Tag < ActiveRecord::Base
end
case params[:order]
when "date"
q = q.order("created_at desc")
when "name"
q = q.order("name")
else
q = q.order("name")
q = q.order("created_at desc")
end
case params[:sort]
when "count"
q = q.order("post_count desc")
when "date"
q = q.order("created_at desc")
when "name"
q = q.order("name")
else
q = q.order("name")
q = q.order("created_at desc")
end
q

View File

@@ -26,7 +26,7 @@ class WikiPage < ActiveRecord::Base
def search(params = {})
q = scoped
return q if params.blank?
params = {} if params.blank?
if params[:title].present?
q = q.where("title LIKE ? ESCAPE E'\\\\'", params[:title].downcase.tr(" ", "_").to_escaped_for_sql_like)