Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10571 (closed defect: fixed)

Opened 10 months ago

Last modified 9 months ago

[PATCH] Titleize doesn't work correctly on "alex's beer"

Reported by: orlick Assigned to: core
Priority: low Milestone: 2.x
Component: ActiveSupport Version: edge
Severity: minor Keywords: tiny, titleize, verified
Cc:

Description

"alex's beer".titleize produces "Alex'S Beer". I am expecting it to produce: "Alex's Beer"

Attachments

correct_apostrohpe_titleize_error.diff (1.3 kB) - added by trek on 12/20/07 03:57:00.
patch file
correct_apostrohpe_titleize_error.2.diff (1.3 kB) - added by trek on 12/20/07 12:54:41.
with lawrence's suggested regexp

Change History

12/20/07 03:50:49 changed by trek

  • keywords set to tiny.

+1... for sure a silly error :p. Patch attached

12/20/07 03:53:00 changed by trek

  • priority changed from normal to low.
  • summary changed from Titleize doesn't work correctly on "alex's beer" to [PATCH] Titleize doesn't work correctly on "alex's beer".

12/20/07 03:57:00 changed by trek

  • attachment correct_apostrohpe_titleize_error.diff added.

patch file

12/20/07 10:22:02 changed by lawrence

+1

Perhaps use the following regex instead though:

/\b'?([a-z])/

(follow-up: ↓ 5 ) 12/20/07 10:23:24 changed by lawrence

sorry, I meant

/\b('?[a-z])/

12/20/07 12:54:41 changed by trek

  • attachment correct_apostrohpe_titleize_error.2.diff added.

with lawrence's suggested regexp

(in reply to: ↑ 4 ) 12/20/07 12:56:49 changed by trek

Replying to lawrence:

sorry, I meant {{{ /\b('?[a-z])/ }}}

more concise, I like it. updated the patch.

12/20/07 18:15:29 changed by matt

  • keywords changed from tiny to tiny, titleize, verified.

+1

01/03/08 00:16:52 changed by david

  • status changed from new to closed.
  • resolution set to fixed.

(In [8533]) Fixed String#titleize to work for strings with 's too (closes #10571) [trek]