-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #633 from rikettsie/master
#623: updated README (added suggestion for manual column alteration).
- Loading branch information
Showing
4 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This migration is added to circumvent issue #623 and have special characters | ||
# work properly | ||
class ChangeCollationForTagNames << ActiveRecord::Migration | ||
|
||
def up | ||
if ActsAsTaggableOn::Utils.using_mysql? | ||
execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;") | ||
end | ||
end | ||
|
||
def down | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# This rake task is to be run by MySql users only, and fixes the management of | ||
# binary-encoded strings for tag 'names'. Issues: | ||
# https://github.com/mbleigh/acts-as-taggable-on/issues/623 | ||
|
||
namespace :acts_as_taggable_on_engine do | ||
|
||
namespace :tag_names do | ||
|
||
desc "Forcing collate of tag names to utf8_bin" | ||
task :collate => [:environment] do |t, args| | ||
puts "Changing collate for column 'name' of table 'tags'" | ||
ActiveRecord::Migration.execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;") | ||
end | ||
|
||
end | ||
|
||
end |