lib/active_support/inflector/methods.rb in activesupport-7.0.5.1 vs lib/active_support/inflector/methods.rb in activesupport-7.0.6
- old
+ new
@@ -134,11 +134,11 @@
inflections.humans.each { |(rule, replacement)| break if result.sub!(rule, replacement) }
result.tr!("_", " ")
result.lstrip!
- unless keep_id_suffix
+ if !keep_id_suffix && lower_case_and_underscored_word.end_with?("_id")
result.delete_suffix!(" id")
end
result.gsub!(/([a-z\d]+)/i) do |match|
match.downcase!
@@ -169,11 +169,9 @@
# output. It is not used in the Rails internals.
#
# The trailing '_id','Id'.. can be kept and capitalized by setting the
# optional parameter +keep_id_suffix+ to true.
# By default, this parameter is false.
- #
- # +titleize+ is also aliased as +titlecase+.
#
# titleize('man from the boondocks') # => "Man From The Boondocks"
# titleize('x-men: the last stand') # => "X Men: The Last Stand"
# titleize('TheManWithoutAPast') # => "The Man Without A Past"
# titleize('raiders_of_the_lost_ark') # => "Raiders Of The Lost Ark"