-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use database's lower function for case-insensitive match #498
Conversation
I ran tests on ruby 1.9.3 and it all went alright.
|
It was failing in rails 3.x. Where is travis when we need it ? :) |
what's the build #? the one's I've seen were failing in rails 4.0, 4.1 and edge (428, 429, 430) |
My mistake. I confused it with another PR. |
Encoding is hell! |
I think this one will pass ! Thank you @leo-souza |
I also added a note on the ICU extension and changed changelog for this PR since this one overwrote that one. is it ok? |
Perfect. 👍 I need to add tests for Arabic,Chinese and Japanese , since these language don't have upcase/downcase. |
@seuros I can write one for hebrew. What about emoji? עברית العربية 日本の 中国的 ✏ |
Go for it 👍 I'm not sure about emoji . But if they pass, why not ? Are you going to add it to this PR ? @leo-souza |
what do you mean? tests for languages with no case? |
I mean we should add it to : "should not care about case for unicode names" |
One option is to offer an adapter for case-insensitive comparison. By default we do 'x', but if you implement 'to_lowercase', you can use that. |
Maybe it should go in another test, because that one only runs in non-sqlite databases. I was thinking something like this it "should be able to create and find tags in languages without capitalization"
ActsAsTaggableOn.strict_case_match = false
chihiro = TaggableModel.create(:name => "Chihiro", :tag_list => "日本の")
salim = TaggableModel.create(:name => "Salim", :tag_list => "עברית")
ieie = TaggableModel.create(:name => "Ieie", :tag_list => "中国的")
yasser = TaggableModel.create(:name => "Yasser", :tag_list => "العربية")
emo = TaggableModel.create(:name => "Emo", :tag_list => "✏")
TaggableModel.tagged_with("日本の").to_a.size.should == 1
TaggableModel.tagged_with("עברית").to_a.size.should == 1
TaggableModel.tagged_with("中国的").to_a.size.should == 1
TaggableModel.tagged_with("العربية").to_a.size.should == 1
TaggableModel.tagged_with("✏").to_a.size.should == 1
end |
👍 |
I saw a green light at the end of the tunnel... but it's gone |
Use database's lower function for case-insensitive match
Don't worry, i had just to restart the job. Everything is fine now. Thank you for your work. |
No problem, I'm glad to contribute |
As I described here #464 (comment), the problem is still exists, and it depends on the database adapter and locale settings. In that case, all the code, which includes databases lower() functions will not work for Postgres, if the database uses LC_COLLATE locale not corresponding to tag's language. It is in many cases more handy to have the LC_COLLATE using "C" locale. |
Use database's lower function for case-insensitive match
This PR is for the same problem as PR #492 but with a diferent solution, since it was breaking the build.
It's similar to PR #472 and relates to issue #464