diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-08 15:15:06 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-08 15:15:06 -0700 |
commit | 86384b3c4b8443f210547094e3e35376240984eb (patch) | |
tree | e92d727f3bdcfe52b7188e30a7f5c407c71e1cc7 | |
parent | 2faa8bbe1152d0c924e3a38cabf9251e2fb972d6 (diff) | |
download | rails-86384b3c4b8443f210547094e3e35376240984eb.tar.gz rails-86384b3c4b8443f210547094e3e35376240984eb.tar.bz2 rails-86384b3c4b8443f210547094e3e35376240984eb.zip |
reduce method calls, use reject + blank? instead of select + present?
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index cee240e6a1..69724ebeeb 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -196,14 +196,14 @@ module ActiveRecord end end - arel = arel.having(*@having_values.uniq.select{|h| h.present?}) unless @having_values.empty? + arel = arel.having(*@having_values.uniq.reject{|h| h.blank?}) unless @having_values.empty? arel = arel.take(@limit_value) if @limit_value arel = arel.skip(@offset_value) if @offset_value - arel = arel.group(*@group_values.uniq.select{|g| g.present?}) unless @group_values.empty? + arel = arel.group(*@group_values.uniq.reject{|g| g.blank?}) unless @group_values.empty? - arel = arel.order(*@order_values.uniq.select{|o| o.present?}) unless @order_values.empty? + arel = arel.order(*@order_values.uniq.reject{|o| o.blank?}) unless @order_values.empty? arel = build_select(arel, @select_values.uniq) |