diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-09 09:44:01 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-09 09:44:01 -0700 |
commit | a505c82d2f4642a16b08a3cbead0a12a22508eba (patch) | |
tree | 7905aaf7455c6912eaef11011ee375b5cdb18465 | |
parent | d5c57f7c9f9a6d095e51c089ce6d72eb5c07cce1 (diff) | |
download | rails-a505c82d2f4642a16b08a3cbead0a12a22508eba.tar.gz rails-a505c82d2f4642a16b08a3cbead0a12a22508eba.tar.bz2 rails-a505c82d2f4642a16b08a3cbead0a12a22508eba.zip |
no need for Array.wrap, also avoid array creation
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 23610ae016..5179fa2188 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -130,7 +130,7 @@ module ActiveRecord 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 @@ module ActiveRecord 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 |