Permalink
Browse files

Kill &block stuff.

  • Loading branch information...
1 parent 4b340ec commit 93ba6ac103124300308f5cc007321e4089b741d0 @metaskills committed Dec 5, 2011
Showing with 8 additions and 6 deletions.
  1. +0 −2 TODO
  2. +6 −2 lib/grouped_scope/self_grouping.rb
  3. +2 −2 test/helper.rb
View
2 TODO
@@ -1,7 +1,5 @@
* Rails 3.1 Implementation
-
- * Kill &block stuff.
* Make association conditions use pure SQL. Avoid 100s of IDs.
@@ -65,9 +65,13 @@ def proxy_class
private
- def method_missing(method, *args, &block)
+ def method_missing(method, *args)
if proxy_class.grouped_reflections[method]
- proxy_owner.send :"grouped_scope_#{method}", *args, &block
+ if block_given?
+ proxy_owner.send(:"grouped_scope_#{method}", *args) { |*block_args| yield(*block_args) }
+ else
+ proxy_owner.send(:"grouped_scope_#{method}", *args)
+ end
else
super
end
View
@@ -75,8 +75,8 @@ def assert_queries(num = 1)
assert_equal num, $queries_executed.size, "#{$queries_executed.size} instead of #{num} queries were executed.#{$queries_executed.size == 0 ? '' : "\nQueries:\n#{$queries_executed.join("\n")}"}"
end
- def assert_no_queries(&block)
- assert_queries(0, &block)
+ def assert_no_queries
+ assert_queries(0) { yield }
end
def setup_database(options)

0 comments on commit 93ba6ac

Please sign in to comment.