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

Changeset 5597

Show
Ignore:
Timestamp:
11/20/06 12:02:04 (2 years ago)
Author:
bitsweat
Message:

Quote ActiveSupport::Multibyte::Chars. Closes #6653.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/CHANGELOG

    r5596 r5597  
    11*SVN* 
     2 
     3* Quote ActiveSupport::Multibyte::Chars.  #6653 [Julian Tarkhanov] 
    24 
    35* Simplify query_attribute by typecasting the attribute value and checking whether it's nil, false, zero or blank.  #6659 [Jonathan Viney] 
  • trunk/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb

    r4626 r5597  
    99 
    1010        case value 
    11           when String 
     11          when String, ActiveSupport::Multibyte::Chars 
     12            value = value.to_s 
    1213            if column && column.type == :binary && column.class.respond_to?(:string_to_binary) 
    1314              "'#{quote_string(column.class.string_to_binary(value))}'" # ' (for ruby-mode) 
  • trunk/activerecord/test/base_test.rb

    r5593 r5597  
    11031103  end 
    11041104   
     1105  def test_quote_chars 
     1106    str = 'The Narrator' 
     1107    topic = Topic.create(:author_name => str) 
     1108    assert_equal str, topic.author_name 
     1109     
     1110    assert_kind_of ActiveSupport::Multibyte::Chars, str.chars 
     1111    topic = Topic.find_by_author_name(str.chars) 
     1112     
     1113    assert_kind_of Topic, topic 
     1114    assert_equal str, topic.author_name, "The right topic should have been found by name even with name passed as Chars" 
     1115  end 
     1116   
    11051117  def test_class_level_destroy 
    11061118    should_be_destroyed_reply = Reply.create("title" => "hello", "content" => "world")