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

Changeset 7588

Show
Ignore:
Timestamp:
09/22/07 23:51:03 (1 year ago)
Author:
bitsweat
Message:

Correctly quote id list for limited eager loading. Closes #7482.

Files:

Legend:

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

    r7577 r7588  
    11*SVN* 
     2 
     3* Correctly quote id list for limited eager loading.  #7482 [tmacedo] 
    24 
    35* Fixed that using version-targetted migrates would fail on loggers other than the default one #7430 [valeksenko] 
  • trunk/activerecord/lib/active_record/associations.rb

    r7504 r7588  
    12571257          end 
    12581258        end 
    1259   
     1259 
    12601260        def select_limited_ids_list(options, join_dependency) 
     1261          pk = columns_hash[primary_key] 
     1262 
    12611263          connection.select_all( 
    12621264            construct_finder_sql_for_association_limiting(options, join_dependency), 
    12631265            "#{name} Load IDs For Limited Eager Loading" 
    1264           ).collect { |row| connection.quote(row[primary_key]) }.join(", ") 
     1266          ).collect { |row| connection.quote(row[primary_key], pk) }.join(", ") 
    12651267        end 
    12661268 
  • trunk/activerecord/test/associations_test.rb

    r7511 r7588  
    18471847    join_dep  = ActiveRecord::Associations::ClassMethods::JoinDependency.new(join_base, :developers, nil) 
    18481848    projects  = Project.send(:select_limited_ids_list, {:order => 'developers.created_at'}, join_dep) 
     1849    assert !projects.include?("'"), projects 
    18491850    assert_equal %w(1 2), projects.scan(/\d/).sort 
    18501851  end