Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Execute less operations

  • Loading branch information...
commit 844b9a50184d3e164c355f24e5240fdec6fb3752 1 parent f1c13b0
@spastorino spastorino authored
View
3  activerecord/lib/active_record/associations/association_collection.rb
@@ -553,8 +553,7 @@ def ensure_owner_is_not_new
def fetch_first_or_last_using_find?(args)
args.first.kind_of?(Hash) || !(loaded? || !@owner.persisted? || @reflection.options[:finder_sql] ||
- @target.any? { |record| !record.persisted? } || args.first.kind_of?(Integer))
- # TODO - would prefer @target.none? { |r| r.persisted? }
+ !@target.all? { |record| record.persisted? } || args.first.kind_of?(Integer))
end
def include_in_memory?(record)
Please sign in to comment.
Something went wrong with that request. Please try again.