Leonard Saers
Leonard Saers

Reputation: 663

acts-as-taggable-on fails in finding items belonging to tags which contains spaces and non English characters such as åäö

I'm using the following code to retrieve all products tagged with a specific tag.

tag = The tag for the products which you would like to find

Product.tagged_with(tag, :on => "product_tags").each do |product|
  # CODE
end

This works for most tagged items. But I'm not able to retrieve products which are tagged with a tag containing the Swedish characters åäö and spaces.

Act as taggable will find products tagged with "a b c", but it will fail finding products tagged with "å ä ö".

It works fine to tagging a product with "å ä ö". The tag will show up when requesting all tags for a product tagged with "å ä ö". The only problem is finding all products tagged with "å ä ö".

What should I do to get acts-as-taggable to work properly with åäö? Could this be an encoding problem?

Upvotes: 0

Views: 252

Answers (1)

pierallard
pierallard

Reputation: 3371

Can you show us the DB queries when you execute

Product.tagged_with(tag, :on => "product_tags")

It will help you to find if it's a acts_as_taggable problem or your database column encodings.

Upvotes: 1

Related Questions