diff options
author | Rick Olson <technoweenie@gmail.com> | 2006-10-13 07:46:38 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2006-10-13 07:46:38 +0000 |
commit | ce1d14430f3ff5c8743541ce5f10b71a083f9c90 (patch) | |
tree | 71b84d533146e2cfbf4a3c52d5a9cccf443225bf /activerecord | |
parent | 065908a4c59f949c49abb97a9483ef16d02ec329 (diff) | |
download | rails-ce1d14430f3ff5c8743541ce5f10b71a083f9c90.tar.gz rails-ce1d14430f3ff5c8743541ce5f10b71a083f9c90.tar.bz2 rails-ce1d14430f3ff5c8743541ce5f10b71a083f9c90.zip |
add test for select_limited_ids_list that passes in mysql/sqlite and fails in postgresql
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5290 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rwxr-xr-x | activerecord/test/associations_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb index e67880681c..d0a80a0f0f 100755 --- a/activerecord/test/associations_test.rb +++ b/activerecord/test/associations_test.rb @@ -1782,4 +1782,19 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase assert_equal projects(:active_record), developer.projects[0] assert_equal projects(:action_controller), developer.projects[1] end + + # this bug highlights an issue in postgresql. fixed in edge, but i had to rollback in [5265]. + def test_select_limited_ids_list + # Set timestamps + Developer.transaction do + Developer.find(:all, :order => 'id').each_with_index do |record, i| + record.update_attributes(:created_at => 5.years.ago + (i * 5.minutes)) + end + end + + join_base = ActiveRecord::Associations::ClassMethods::JoinDependency::JoinBase.new(Project) + join_dep = ActiveRecord::Associations::ClassMethods::JoinDependency.new(join_base, :developers, nil) + projects = Project.send(:select_limited_ids_list, {:order => 'developers.created_at'}, join_dep) + assert_equal "'1', '2'", projects + end end |