class String
def parameterize(separator: "-", preserve_case: false, locale: nil)
# => Donald E. Knuth
<%= link_to(@person.name, person_path) %>
# => #
@person = Person.find(1)
end
end
"#{id}-#{name.parameterize(preserve_case: true)}"
def to_param
class Person
To preserve the case of the characters in a string, use the +preserve_case+ argument.
# => Donald E. Knuth
<%= link_to(@person.name, person_path) %>
# => #
@person = Person.find(1)
end
end
"#{id}-#{name.parameterize}"
def to_param
class Person
the configured I18n.locale.
By default, this parameter is set to nil and it will use
the word will be parameterized as a word of that language.
If the optional parameter +locale+ is specified,
Replaces special characters in a string so that it may be used as part of a 'pretty' URL.
def parameterize(separator: "-", preserve_case: false, locale: nil) ActiveSupport::Inflector.parameterize(self, separator: separator, preserve_case: preserve_case, locale: locale) end