Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

removing nonsensical tests, limit now actually adds a limit

  • Loading branch information...
commit a88af8a6694f6b7577497224b6bc7df9c06c1f73 1 parent d5e9165
@tenderlove tenderlove authored
View
14 activerecord/CHANGELOG
@@ -1,7 +1,19 @@
*Rails 3.0.1 (unreleased)*
-* No changes
+* The following code:
+ Model.limit(10).scoping { Model.count }
+
+ now generates the following SQL:
+
+ SELECT COUNT(*) FROM models LIMIT 10
+
+ This may not return what you want. Instead, you may with to do something
+ like this:
+
+ Model.limit(10).scoping { Model.all.size }
+
+ [Aaron Patterson]
*Rails 3.0.0 (August 29, 2010)*
View
2  activerecord/test/cases/relation_scoping_test.rb
@@ -161,7 +161,7 @@ def test_merge_options
def test_merge_inner_scope_has_priority
Developer.limit(5).scoping do
Developer.limit(10).scoping do
- assert_equal 10, Developer.count
+ assert_equal 10, Developer.all.size
end
end
end
View
4 activerecord/test/cases/relations_test.rb
@@ -679,10 +679,6 @@ def test_order_by_relation_attribute
assert_equal Post.order(Post.arel_table[:title]).all, Post.order("title").all
end
- def test_relations_limit_with_conditions_or_limit
- assert_equal Post.limit(2).size, Post.limit(2).all.size
- end
-
def test_order_with_find_with_order
assert_equal 'zyke', Car.order('name desc').find(:first, :order => 'id').name
end
Please sign in to comment.
Something went wrong with that request. Please try again.