aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/refinery/admin
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/refinery/admin')
-rw-r--r--app/controllers/refinery/admin/blog/posts_controller.rb20
1 files changed, 8 insertions, 12 deletions
diff --git a/app/controllers/refinery/admin/blog/posts_controller.rb b/app/controllers/refinery/admin/blog/posts_controller.rb
index aa40c85..8b3816d 100644
--- a/app/controllers/refinery/admin/blog/posts_controller.rb
+++ b/app/controllers/refinery/admin/blog/posts_controller.rb
@@ -20,18 +20,14 @@ module Refinery
end
def tags
- op = case ActiveRecord::Base.connection.adapter_name.downcase
- when 'postgresql'
- '~*'
- else
- 'LIKE'
- end
- wildcard = case ActiveRecord::Base.connection.adapter_name.downcase
- when 'postgresql'
- '.*'
- else
- '%'
- end
+ if ActiveRecord::Base.connection.adapter_name.downcase == 'postgresql'
+ op = '~*'
+ wildcard = '.*'
+ else
+ op = 'LIKE'
+ wildcard = '%'
+ end
+
@tags = Refinery::Blog::Post.tag_counts_on(:tags).where(
["tags.name #{op} ?", "#{wildcard}#{params[:term].to_s.downcase}#{wildcard}"]
).map { |tag| {:id => tag.id, :value => tag.name}}