aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorSwaathi K <swaathi@skcript.com>2015-10-07 17:46:38 +0530
committerSwaathi K <swaathi@skcript.com>2015-11-07 16:57:04 +0530
commitc9143e15a1ba75137d6c9fe844d8b27dbc412835 (patch)
treeed65aa404707af702d8200ce7a35ee6a9e97b51e /guides
parentaf3ac5022ec252e45c14f460875edadfb7a64d38 (diff)
downloadrails-c9143e15a1ba75137d6c9fe844d8b27dbc412835.tar.gz
rails-c9143e15a1ba75137d6c9fe844d8b27dbc412835.tar.bz2
rails-c9143e15a1ba75137d6c9fe844d8b27dbc412835.zip
Parameterize with options to preserve case of string
Added test cases Using kwargs instead of three seperate functions Updated parameterize in transliterate.rb Updated parameterize in transliterate.rb Added deprecation warnings and updating RDoc+Guide Misspelled separtor. Fixed. Deprecated test cases and added support to parameterize with keyword parameters Squashing commits. Fixed test cases and added deprecated test cases Small changes to Gemfile.lock and CHANGELOG Update Gemfile.lock
Diffstat (limited to 'guides')
-rw-r--r--guides/source/active_support_core_extensions.md14
1 files changed, 14 insertions, 0 deletions
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md
index f6fc255c24..181dca4b71 100644
--- a/guides/source/active_support_core_extensions.md
+++ b/guides/source/active_support_core_extensions.md
@@ -1710,6 +1710,20 @@ The method `parameterize` normalizes its receiver in a way that can be used in p
"Kurt Gödel".parameterize # => "kurt-godel"
```
+To preserve the case of the string, set the `preserve_case` argument to true. By default, `preserve_case` is set to false.
+
+```ruby
+"John Smith".parameterize(preserve_case: true) # => "John-Smith"
+"Kurt Gödel".parameterize(preserve_case: true) # => "Kurt-Godel"
+```
+
+To use a custom separator, override the `separator` argument.
+
+```ruby
+"John Smith".parameterize(separator: "_") # => "john\_smith"
+"Kurt Gödel".parameterize(separator: "_") # => "kurt\_godel"
+```
+
In fact, the result string is wrapped in an instance of `ActiveSupport::Multibyte::Chars`.
NOTE: Defined in `active_support/core_ext/string/inflections.rb`.