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

Changeset 8340

Show
Ignore:
Timestamp:
12/09/07 22:10:40 (5 months ago)
Author:
bitsweat
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activesupport/lib/active_support/core_ext/array/conversions.rb

    r8301 r8340  
    1717              "" 
    1818            when 1 
    19               self[0] 
     19              self[0].to_s 
    2020            when 2 
    2121              "#{self[0]} #{options[:connector]}#{self[1]}" 
  • trunk/activesupport/test/core_ext/array_ext_test.rb

    r8251 r8340  
    3434    assert_equal "one and two", ['one', 'two'].to_sentence 
    3535    assert_equal "one, two, and three", ['one', 'two', 'three'].to_sentence 
    36  
    3736  end 
    3837 
     
    5857  end 
    5958 
     59  def test_one_non_string_element 
     60    assert_equal '1', [1].to_sentence 
     61  end 
    6062end 
    6163