diff options
author | Tony Jian <tonytonyjan@gmail.com> | 2012-04-29 14:15:36 +0800 |
---|---|---|
committer | Tony Jian <tonytonyjan@gmail.com> | 2012-04-29 14:15:36 +0800 |
commit | 70e0edf000289b1907b8aee386daf23577f6bc08 (patch) | |
tree | cafa7d551f52ac48863e964cf0227d214a9ac9e6 /guides | |
parent | d7532c189f26e008fc6ef50336ed5e8168b8221c (diff) | |
download | rails-70e0edf000289b1907b8aee386daf23577f6bc08.tar.gz rails-70e0edf000289b1907b8aee386daf23577f6bc08.tar.bz2 rails-70e0edf000289b1907b8aee386daf23577f6bc08.zip |
Make non English title indexable (such as Chinese or Japanese) using MD5.
Diffstat (limited to 'guides')
-rw-r--r-- | guides/rails_guides/indexer.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/guides/rails_guides/indexer.rb b/guides/rails_guides/indexer.rb index 89fbccbb1d..1847f09881 100644 --- a/guides/rails_guides/indexer.rb +++ b/guides/rails_guides/indexer.rb @@ -59,8 +59,9 @@ module RailsGuides def title_to_idx(title) idx = title.strip.parameterize.sub(/^\d+/, '') - if warnings && idx.blank? - puts "BLANK ID: please put an explicit ID for section #{title}, as in h5(#my-id)" + if idx.blank? + puts "BLANK ID: please put an explicit ID for section #{title}, as in h5(#my-id)" if warnings + idx = ("id-"+Digest::MD5.hexdigest(title.strip)).parameterize.sub(/^\d+/, '') end idx end |