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