I am accessing a database table with the .where() method. This should return many rows. How can I view the first row, or the second row. I know I can use the .each method to traverse all rows but what if I just want to access a certain row. I am new to rails, so sorry for this simple question.
I am accessing a database table with the .where() method. This should return many
Share
To get the first row, you can just use
.first.lastworks the same way:To get the nth row, use
[]with a 0-based index, as with any other array