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

Ticket #10390 (closed defect: fixed)

Opened 6 months ago

Last modified 5 months ago

[PATCH][TINY] Ensure to_sentence returns a string for arrays of length 1

Reported by: mrj Assigned to: core
Priority: normal Milestone: 2.x
Component: ActiveSupport Version: edge
Severity: normal Keywords: to_sentence
Cc:

Description

to_sentence returns self[0] for arrays of length 1 instead of self[0].to_s.

http://dev.rubyonrails.org/browser/trunk/activesupport/lib/active_support/core_ext/array/conversions.rb#L19

Attachments

fix_to_sentence_for_1_element.diff (1.1 kB) - added by chuyeow on 12/06/07 06:06:57.

Change History

12/06/07 06:06:57 changed by chuyeow

  • attachment fix_to_sentence_for_1_element.diff added.

12/06/07 06:07:36 changed by chuyeow

  • summary changed from Ensure to_sentence returns a string for arrays of length 1 to [PATCH][TINY] Ensure to_sentence returns a string for arrays of length 1.

Attached a patch with tests for your issue.

12/06/07 08:45:13 changed by mrj

Good work. Thanks.

12/07/07 03:40:15 changed by brandon

Good catch. +1

12/09/07 22:10:44 changed by bitsweat

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

(In [8340]) to_sentence returns self[0].to_s instead of just self[0] for arrays of length 1. Closes #10390 [Chu Yeow, mrj]