Permalink
Browse files

Merge pull request #10539 from davidcelis/ar-sql-improvements

Improve performance of ActiveRecord::Relation#blank?
  • Loading branch information...
2 parents 94725b8 + 4e2bec3 commit 257fa6897d9c85da16b7c9fcb4ae3008198d320e @jonleighton jonleighton committed Jun 7, 2013
Showing with 1 addition and 5 deletions.
  1. +1 −5 activerecord/lib/active_record/relation.rb
@@ -21,6 +21,7 @@ class Relation
alias :model :klass
alias :loaded? :loaded
alias :default_scoped? :default_scoped
+ alias :blank? :empty?
def initialize(klass, table, values = {})
@klass = klass
@@ -575,11 +576,6 @@ def with_default_scope #:nodoc:
end
end
- # Returns true if relation is blank.
- def blank?
- to_a.blank?
- end
-
def values
Hash[@values]
end

0 comments on commit 257fa68

Please sign in to comment.