Active Record - Get the second, third.. item in a database (without ID)

后端 未结 3 1154
终归单人心
终归单人心 2021-01-01 20:45

How to I retrieve the second, third .. entries in a database. I don\'t want to use the auto incrementing id generated by rails.

As I am deleting entries from my data

3条回答
  •  一生所求
    2021-01-01 20:52

    Model.second was added to Rails 4.1.8.

    So you can use it on Rails versions equal to or greater than that.

    .third, .fourth and .fifth were also added to ActiveRecord::FinderMethods.

提交回复
热议问题