diff options
author | Neeraj Singh <neerajdotname@gmail.com> | 2010-09-08 11:59:10 -0400 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-09 09:35:40 -0700 |
commit | d5c57f7c9f9a6d095e51c089ce6d72eb5c07cce1 (patch) | |
tree | 4e922d971f959694aa7f6781c7bd38bd9941e53a /activerecord/lib/active_record/relation | |
parent | d73b47fc22e987ff1e2f03b07b343890c822f174 (diff) | |
download | rails-d5c57f7c9f9a6d095e51c089ce6d72eb5c07cce1.tar.gz rails-d5c57f7c9f9a6d095e51c089ce6d72eb5c07cce1.tar.bz2 rails-d5c57f7c9f9a6d095e51c089ce6d72eb5c07cce1.zip |
make apply_modules run faster
Diffstat (limited to 'activerecord/lib/active_record/relation')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 6d6ae5e5c6..23610ae016 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -276,9 +276,11 @@ module ActiveRecord end def apply_modules(modules) - values = Array.wrap(modules) - @extensions += values unless values.blank? - values.each {|extension| extend(extension) } + if modules.present? + values = Array.wrap(modules) + @extensions += values + values.each {|extension| extend(extension) } + end end def reverse_sql_order(order_query) |