diff options
author | Gonçalo Silva <goncalossilva@gmail.com> | 2011-03-24 17:21:17 +0000 |
---|---|---|
committer | Gonçalo Silva <goncalossilva@gmail.com> | 2011-03-24 17:21:17 +0000 |
commit | 9887f238871bb2dd73de6ce8855615bcc5d8d079 (patch) | |
tree | 74fa9ff9524a51701cfa23f708b3f777c65b7fe5 /railties/guides/rails_guides/indexer.rb | |
parent | aff821508a16245ebc03510ba29c70379718dfb7 (diff) | |
parent | 5214e73850916de3c9127d35a4ecee0424d364a3 (diff) | |
download | rails-9887f238871bb2dd73de6ce8855615bcc5d8d079.tar.gz rails-9887f238871bb2dd73de6ce8855615bcc5d8d079.tar.bz2 rails-9887f238871bb2dd73de6ce8855615bcc5d8d079.zip |
Merge branch 'master' of https://github.com/rails/rails
Diffstat (limited to 'railties/guides/rails_guides/indexer.rb')
-rw-r--r-- | railties/guides/rails_guides/indexer.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/railties/guides/rails_guides/indexer.rb b/railties/guides/rails_guides/indexer.rb index bd817786ed..fb46491817 100644 --- a/railties/guides/rails_guides/indexer.rb +++ b/railties/guides/rails_guides/indexer.rb @@ -1,5 +1,6 @@ require 'active_support/core_ext/object/blank' require 'active_support/ordered_hash' +require 'active_support/core_ext/string/inflections' module RailsGuides class Indexer @@ -58,7 +59,7 @@ module RailsGuides end def title_to_idx(title) - idx = title.strip.downcase.gsub(/\s+|_/, '-').delete('^a-z0-9-').sub(/^[^a-z]*/, '') + 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)" end |