instance method
first
Ruby on Rails 3.2.22.5
Since v3.0.20Signature
first(*args)
A convenience wrapper for find(:first, *args). You can pass in all the same arguments to this method as you can to find(:first).
Parameters
-
argsrest
Source
# File activerecord/lib/active_record/relation/finder_methods.rb, line 114
def first(*args)
if args.any?
if args.first.kind_of?(Integer) || (loaded? && !args.first.kind_of?(Hash))
limit(*args).to_a
else
apply_finder_options(args.first).first
end
else
find_first
end
end
Defined in activerecord/lib/active_record/relation/finder_methods.rb line 114
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::FinderMethods