mysql - acts-as-taggable-on and select fields -


i'm using actsastaggableon gem rails 3.0 , works fine.

now i'm trying speed queries selecting fields activerecord:

@items = item.select("items.id, items.title").where("items.title not null)  @items.tag_counts 

but got error mysql:

> activerecord::statementinvalid: mysql::error: operand should contain 1 column(s): select sql_no_cache tags.*, count(*) count `tags` left outer join taggings on tags.id = taggings.tag_id , taggings.context = 'tags' inner join items on items.id =  taggings.taggable_id (taggings.taggable_type = 'item') , (taggings.taggable_id in(select items.id, items.title, items.id `items` (title not null))) group tags.id, tags.name having count(*) > 0 

instead if regularly call tag_counts on collection works:

@items = item.where("items.title not null)  @items.tag_counts 

any ideas simple workaround without editing gem?


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -