aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/refinery/admin
diff options
context:
space:
mode:
authorPhilip Arndt <parndt@gmail.com>2011-11-10 09:23:02 +1300
committerPhilip Arndt <parndt@gmail.com>2011-11-10 09:23:02 +1300
commitf9f56c6f1c5ee277f5b0a335ca12a4eea275d42d (patch)
tree37bccbf5da9e688e5d6c8be5d3f10d03c4c25e75 /app/controllers/refinery/admin
parent81475ff3809d83e46ff28f39523abfc5cb1635a4 (diff)
parent12164fd95a1884a340283554ed5dbeedce916b80 (diff)
downloadrefinerycms-blog-f9f56c6f1c5ee277f5b0a335ca12a4eea275d42d.tar.gz
refinerycms-blog-f9f56c6f1c5ee277f5b0a335ca12a4eea275d42d.tar.bz2
refinerycms-blog-f9f56c6f1c5ee277f5b0a335ca12a4eea275d42d.zip
Merge branch 'master' into rails-3-1
Conflicts: app/controllers/admin/blog/posts_controller.rb app/controllers/blog/posts_controller.rb
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}}