Permalink
Browse files

no need for Array.wrap, also avoid array creation

  • Loading branch information...
1 parent a9b5b19 commit 7108daf20ec597aa8d06dce2dd24939b9d33f009 @tenderlove tenderlove committed Sep 9, 2010
Showing with 4 additions and 5 deletions.
  1. +4 −5 activerecord/lib/active_record/relation/query_methods.rb
@@ -130,7 +130,7 @@ def extending(*modules, &block)
modules << Module.new(&block) if block_given?
relation = clone
- relation.send(:apply_modules, *modules)
+ relation.send(:apply_modules, modules.flatten)
relation
end
@@ -276,10 +276,9 @@ def build_select(arel, selects)
end
def apply_modules(modules)
- if modules.present?
- values = Array.wrap(modules)
- @extensions += values
- values.each {|extension| extend(extension) }
+ unless modules.empty?
+ @extensions.concat modules
+ modules.each {|extension| extend(extension) }
end
end

0 comments on commit 7108daf

Please sign in to comment.