Skip to content

Commit

Permalink
Kill &block stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
metaskills committed Dec 5, 2011
1 parent 4b340ec commit 93ba6ac
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 0 additions & 2 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

* Rails 3.1 Implementation

* Kill &block stuff.

* Make association conditions use pure SQL. Avoid 100s of IDs.

Expand Down
8 changes: 6 additions & 2 deletions lib/grouped_scope/self_grouping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 93ba6ac

Please sign in to comment.