fix for pool selection

This commit is contained in:
albert
2013-02-19 13:30:55 -05:00
parent 6ab2bc3a70
commit e7aff87c65
7 changed files with 8 additions and 12 deletions

View File

@@ -25,6 +25,7 @@ class Pool < ActiveRecord::Base
return q if params.blank?
if params[:name_matches].present?
params[:name_matches] = params[:name_matches].tr(" ", "_")
params[:name_matches] += "*" unless params[:name_matches] =~ /\*/
q = q.where("name ilike ? escape E'\\\\'", params[:name_matches].to_escaped_for_sql_like)
end
@@ -66,7 +67,7 @@ class Pool < ActiveRecord::Base
end
def self.options
select_all_sql("SELECT id, name FROM pools WHERE is_active = true AND is_deleted = false ORDER BY name LIMIT 100").map {|x| [x["name"], x["id"]]}
select_all_sql("SELECT id, name FROM pools WHERE is_active = true AND is_deleted = false ORDER BY name LIMIT 100").map {|x| [x["name"].tr("_", " "), x["id"]]}
end
def self.create_anonymous

View File

@@ -402,10 +402,10 @@ class Tag < ActiveRecord::Base
case params[:sort].present?
when "count"
q = q.order("post_count")
q = q.order("post_count desc")
when "date"
q = q.order("created_at")
q = q.order("created_at desc")
else
q = q.order("name")