diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-30 14:05:26 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-30 14:05:26 -0700 |
commit | ecfb252e7a99bac6569f744064ef7f1ee1b31556 (patch) | |
tree | 9ee54e0920cd04e11c514b0c08a86446085c9abd | |
parent | d1c53a9ad273f31618adcfbcabb39fd74bb2b91f (diff) | |
download | rails-ecfb252e7a99bac6569f744064ef7f1ee1b31556.tar.gz rails-ecfb252e7a99bac6569f744064ef7f1ee1b31556.tar.bz2 rails-ecfb252e7a99bac6569f744064ef7f1ee1b31556.zip |
fewer method calls, using faster methods when possible
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 4342dde5c8..b941231a65 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -143,18 +143,18 @@ module ActiveRecord end end - arel = arel.having(*@having_values.uniq.select{|h| h.present?}) if @having_values.present? + arel = arel.having(*@having_values.uniq.select{|h| h.present?}) unless @having_values.empty? arel = arel.take(@limit_value) if @limit_value - arel = arel.skip(@offset_value) if @offset_value.present? + arel = arel.skip(@offset_value) if @offset_value - arel = arel.group(*@group_values.uniq.select{|g| g.present?}) if @group_values.present? + arel = arel.group(*@group_values.uniq.select{|g| g.present?}) unless @group_values.empty? - arel = arel.order(*@order_values.uniq.select{|o| o.present?}) if @order_values.present? + arel = arel.order(*@order_values.uniq.select{|o| o.present?}) unless @order_values.empty? arel = build_select(arel, @select_values.uniq) - arel = arel.from(@from_value) if @from_value.present? + arel = arel.from(@from_value) if @from_value arel = arel.lock(@lock_value) if @lock_value arel |