aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/admin/blog/posts_controller.rb16
-rw-r--r--lib/refinery/blog/version.rb2
-rw-r--r--refinerycms-blog.gemspec2
3 files changed, 16 insertions, 4 deletions
diff --git a/app/controllers/admin/blog/posts_controller.rb b/app/controllers/admin/blog/posts_controller.rb
index 9fdc638..29ffb01 100644
--- a/app/controllers/admin/blog/posts_controller.rb
+++ b/app/controllers/admin/blog/posts_controller.rb
@@ -12,9 +12,21 @@ class Admin::Blog::PostsController < Admin::BaseController
end
def tags
+ op = case ActiveRecord::Base.connection.adapter_name.downcase
+ when 'postgresql'
+ 'SIMILAR TO'
+ else
+ 'LIKE'
+ end
+ wildcard = case ActiveRecord::Base.connection.adapter_name.downcase
+ when 'postgresql'
+ '.*'
+ else
+ '%'
+ end
@tags = BlogPost.tag_counts_on(:tags).where(
- ["tags.name LIKE ?", "%#{params[:term].to_s.downcase}%"]
- ).map { |tag| {:id => tag.id, :value => tag.name}}
+ ["tags.name #{op} ?", "#{wildcard}#{params[:term].to_s.downcase}#{wildcard}"]
+ ).map { |tag| {:id => tag.id, :value => tag.name}}
render :json => @tags.flatten
end
diff --git a/lib/refinery/blog/version.rb b/lib/refinery/blog/version.rb
index b4bad51..62e3490 100644
--- a/lib/refinery/blog/version.rb
+++ b/lib/refinery/blog/version.rb
@@ -3,7 +3,7 @@ module Refinery
class Version
@major = 1
@minor = 6
- @tiny = 0
+ @tiny = 1
class << self
attr_reader :major, :minor, :tiny
diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec
index 32739fc..cc6977d 100644
--- a/refinerycms-blog.gemspec
+++ b/refinerycms-blog.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = %q{refinerycms-blog}
- s.version = %q{1.6.0}
+ s.version = %q{1.6.1}
s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.}
s.date = %q{2011-06-21}
s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.}