Permalink
Browse files

simplify each method.

Stop writing terrible code Aaron.  This is Ruby, not Scheme
  • Loading branch information...
1 parent a8a33ac commit 82d81bbfcb4d0d895e9ba059f33a3495879bc660 @tenderlove tenderlove committed Oct 10, 2013
Showing with 2 additions and 8 deletions.
  1. +2 −8 activerecord/lib/active_record/associations/join_dependency/join_part.rb
@@ -50,15 +50,9 @@ def parents
parents
end
- def each
+ def each(&block)
yield self
- iter = lambda { |list|
- list.each { |item|
- yield item
- iter.call item.children
- }
- }
- iter.call children
+ children.each { |child| child.each(&block) }
end
def aliased_table

0 comments on commit 82d81bb

Please sign in to comment.