Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

Improve performance of ActiveRecord::Relation#blank?
  • Loading branch information...
commit 257fa6897d9c85da16b7c9fcb4ae3008198d320e 2 parents 94725b8 + 4e2bec3
@jonleighton jonleighton authored
Showing with 1 addition and 5 deletions.
  1. +1 −5 activerecord/lib/active_record/relation.rb
View
6 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
Please sign in to comment.
Something went wrong with that request. Please try again.