diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-10 10:09:15 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-10 10:09:15 -0700 |
commit | 82d81bbfcb4d0d895e9ba059f33a3495879bc660 (patch) | |
tree | aeded143cb4ec5fa53a5b056288c9957fc8ce97e /activerecord/lib | |
parent | a8a33ac663fce963a59517132c1154f43e9a85ad (diff) | |
download | rails-82d81bbfcb4d0d895e9ba059f33a3495879bc660.tar.gz rails-82d81bbfcb4d0d895e9ba059f33a3495879bc660.tar.bz2 rails-82d81bbfcb4d0d895e9ba059f33a3495879bc660.zip |
simplify each method.
Stop writing terrible code Aaron. This is Ruby, not Scheme
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations/join_dependency/join_part.rb | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/associations/join_dependency/join_part.rb b/activerecord/lib/active_record/associations/join_dependency/join_part.rb index d536eaf613..7175dff5ac 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_part.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_part.rb @@ -50,15 +50,9 @@ module ActiveRecord 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 |