Skip to content

Commit

Permalink
add test for select_limited_ids_list that passes in mysql/sqlite and …
Browse files Browse the repository at this point in the history
…fails in postgresql

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5290 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
technoweenie committed Oct 13, 2006
1 parent 065908a commit ce1d144
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions activerecord/test/associations_test.rb
Expand Up @@ -1782,4 +1782,19 @@ def test_assign_ids_ignoring_blanks
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

0 comments on commit ce1d144

Please sign in to comment.