Method: ActiveRecord::FinderMethods#second
- Defined in:
- activerecord/lib/active_record/relation/finder_methods.rb
#second ⇒ Object
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
223 224 225 |
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 223 def second find_nth 1 end |