Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use scoped.first and scoped.last instead of find(:first, ...) and fin…

…d(:last, ...)
  • Loading branch information...
commit 1a4bbaf106f09c8a67c7e4da109a46449c06374f 1 parent 1e7cf6c
Jon Leighton jonleighton authored
4 activerecord/lib/active_record/associations/association_collection.rb
View
@@ -39,7 +39,7 @@ def find(*args)
# Fetches the first one using SQL if possible.
def first(*args)
if fetch_first_or_last_using_find?(args)
- find(:first, *args)
+ scoped.first(*args)
else
load_target unless loaded?
args.shift if args.first.kind_of?(Hash) && args.first.empty?
@@ -50,7 +50,7 @@ def first(*args)
# Fetches the last one using SQL if possible.
def last(*args)
if fetch_first_or_last_using_find?(args)
- find(:last, *args)
+ scoped.last(*args)
else
load_target unless loaded?
@target.last(*args)
Please sign in to comment.
Something went wrong with that request. Please try again.