-
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
Duplicate entries for tags with spÉcial characters #623
Comments
You have to either provide a test case or backtrace. |
Sorry for that Here is a gist of what occurs : https://gist.github.com/bbnnt/7aadc59bea0edb24630d Encoding of the table is UTF-8 unicode and collation is utf-8_general_ci |
I can't reproduce this bug. |
Can you reproduce it with a fresh database/app ? |
Yes :/ Then tried again, starting with only the command that you'l see in the gist / capture I checked again, the table has the encoding specified above, by default |
Could reproduce this bug. It also happens with the Japanese space -> " " |
Too bad it is not such an issue for the maintainer ad the logs provided pretty much shows that it does occurs |
@bbnnt : |
@seuros that was not an argument; but more or less to get a reply from you (: |
👍 |
@bbnnt This project is really hard to maintain. It's a really old code base with lots of bugs, frequently reported issues, and none of the maintainers, as far as I know, use it anymore. |
@bf4 damn i'm getting old-schooled ! would you recommend another gem that has similar functionalities ? |
@bbnnt The fact that we don't use this gem don't mean we using a better alternative. It simply mean we don't need it. |
I can't recommend it, as I haven't used it, but there's also gutentag
https://github.com/pat/gutentag
|
@bbnnt the problem is related to the COLLATION actually applied to the 'name' column when a new tag name is about to be stored. For a quick circumvention, you could alter the 'tags' table column 'name', e.g. in MySql: ALTER TABLE tags MODIFY name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin; |
@rikettsie wow it seems to have solved the problem (: |
You are welcome ;-) |
@rikettsie : Could you update the readme and send a pr ? |
…acters in tags (MySql only)
#623: updated README (added suggestion for manual column alteration).
#623: solve matching of binary-encoded strings with MySql (via rake rule or initializer setting)
@seuros @rikettsie @bbnnt Since the change_collation_for_tag_names now gets copied over together with the other migrations when calling 'rake acts_as_taggable_on_engine:install:migrations', is it still necessary to set the initializer 'ActsAsTaggableOn.force_binary_collation = true' as described in the readme? |
@Morred it seems that it's already included in the migrations. After running
|
@Morred can you provide the error you obtain while migrating? |
@carlosescri Yes, it's in the migrations that get copied over when you run "rake acts_as_taggable_on_engine:install:migrations". @rikettsie If I set ActsAsTaggableOn.force_binary_collation = true in the initializer, I get this error when running "rake db:migrate":
This happens only if the migrations that come from "rake acts_as_taggable_on_engine:install:migrations" haven't run yet, and therefore the tags table doesn't exist yet. If I remove the line in the initializer, the migrations run without a problem, and if I re-add the line after that, I can also run it without issues once the table exists. So I guess it tries to run the initializer before the actual migrations for some reason? |
Yes @Morred, you should install and run migrations before adding the force_binary_collation parameter to the initializer file (otherwise the parameter gets executed when the application environment loads the first time and the table does not exist yet). |
#623 collation parameter is ignored if it generates an exception.
@rikettsie That would be great. If it's only myself, I can run the migrations and then add that line, but if there are more people working on a project and somebody git clones the thing and then tries to run the migrations, they would have to remove the line, run the migrations and then add the line back into the initializer, which is somewhat inconvenient. A fix would be very much appreciated! |
@Morred, I fixed it yesterday and the diff merged into master. It is ready for next version. |
@rikettsie Awesome, thanks! |
* master: (26 commits) mbleigh#623 collation parameter is ignored if it generates an exception. Update release date for 3.5.0 Update README.md Changing ActsAsTaggable to ActsAsTaggableOn version 3.5.0 Add context constraint to find_related_* methods. Fixes mbleigh#628 added rake rule and a config parameter to force binary collation (MySql) added migration and rake task mbleigh#623: added manual column alter suggestion to fix special characters in tags (MySql only) version bump Add context constraint to find_related_* methods. Fixes mbleigh#628 Fixing typo in docs with strong typing Namespaced TagList usage in a customer parser version bump, test on ruby 2.2, remove rails edge from matrix. clears column cache on reset_column_information resolves mbleigh#621 Use the new build env on Travis Update README.md sha_prefix should not be random Fix milestones link Meet interface expectation for active record. ...
For anyone using the character set of
And in the case of MySQL 5.6:
|
…acters in tags (MySql only)
mbleigh#623: updated README (added suggestion for manual column alteration).
mbleigh#623: solve matching of binary-encoded strings with MySql (via rake rule or initializer setting)
mbleigh#623 collation parameter is ignored if it generates an exception.
Updated and all, but the problems remains.
If for example the word "Numérique" is saved, and if it already exists, acts_as_taggable breaks.
Same will go for "numerique".
Is there a way to handle it ?
The text was updated successfully, but these errors were encountered: