tag查询崩溃

This commit is contained in:
yanxd 2014-07-01 16:01:42 +08:00 committed by xianbo
parent 830e2d4fb4
commit e1d9d6ab45
2 changed files with 13 additions and 8 deletions

View File

@ -256,14 +256,14 @@ class TagsController < ApplicationController
# 获取有某类对象的tag总数 # 获取有某类对象的tag总数
def get_tags_size def get_tags_size
@issues_tags_num = Issue.tag_counts.size @issues_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Issue").count
@projects_tags_num = Project.tag_counts.size @projects_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Project").count
@users_tags_num = User.tag_counts.size @users_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"User").count
@bids_tags_num = Bid.tag_counts.size @bids_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Bid").count
forum_tags_num = Forum.tag_counts.size forum_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Forum").count
attachment_tags_num = Attachment.tag_counts.size attachment_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Attachment").count
@open_source_projects_num = OpenSourceProject.tag_counts.size @open_source_projects_num = ActsAsTaggableOn::Tagging.where(taggable_type:"OpenSourceProject").count
@contests_tags_num = Contest.tag_counts.size @contests_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Contest").count
return @users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num, forum_tags_num, attachment_tags_num, @contests_tags_num, @open_source_projects_num return @users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num, forum_tags_num, attachment_tags_num, @contests_tags_num, @open_source_projects_num
end end

View File

@ -0,0 +1,5 @@
class AddTagTypeIndexToTagging < ActiveRecord::Migration
def change
add_index :taggings, :taggable_type
end
end