instance method
second
Ruby on Rails 6.1.7.10
Since v4.1.16Signature
second()
Find the second record. If no order is defined it will order by primary key.
Person.second # returns the second object fetched by SELECT * FROM people Person.offset(3).second # returns the second object from OFFSET 3 (which is OFFSET 4) Person.where(["user_name = :u", { u: user_name }]).second
Source
# File activerecord/lib/active_record/relation/finder_methods.rb, line 168
def second
find_nth 1
end
Defined in activerecord/lib/active_record/relation/finder_methods.rb line 168
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::FinderMethods