aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/admin/blog/posts_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/admin/blog/posts_controller.rb')
-rw-r--r--app/controllers/admin/blog/posts_controller.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/controllers/admin/blog/posts_controller.rb b/app/controllers/admin/blog/posts_controller.rb
index e8ffed2..7569aa6 100644
--- a/app/controllers/admin/blog/posts_controller.rb
+++ b/app/controllers/admin/blog/posts_controller.rb
@@ -11,6 +11,14 @@ class Admin::Blog::PostsController < Admin::BaseController
})
end
+ def tags
+ @tags = BlogPost.tag_counts_on(:tags).where(["tags.name LIKE ?", "%#{params[:term].to_s.downcase}%"])
+ .collect { |tag|
+ {:id => tag.id, :value => tag.name}
+ }
+ render :json => @tags.flatten
+ end
+
def create
# if the position field exists, set this object as last object, given the conditions of this class.
if BlogPost.column_names.include?("position")