How to return middle records in rails db?

sharataka

To get the last 10 records in my rails db, I use:

pictures = Picture.last(10)

How do I get the 10 before these?

pictures = Picture.last(20)

returns 20 results, not just the records from 11-20.

ErJab

If you want records between 11 and 20 you could do

Picture.limit(10).offset(11)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to find index of array of records return from database in rails?

From Dev

Rails nested fields_for duplicate records in DB

From Dev

How to sort DB records by parent

From Dev

Rails like query return records if posted empty

From Dev

How to return response to client in the middle of Promise?

From Dev

How to return response to client in the middle of Promise?

From Dev

How can I get all records that return True in a model function in a rails app?

From Dev

How to show unique records in Rails?

From Dev

rails how to find with no associated records

From Dev

How to prevent duplicate records in Rails

From Dev

MongoDB Java Driver: Return a List of DB Records as a Single Object

From Dev

Rails 4: dashboard/analytics and querying ALL records in DB

From Dev

How to insert batch of 1000 records into db?

From Dev

How to calculate a lot of records in DB with reasonable time

From Dev

How to sort mongo db records in mule

From Dev

FuelPHP - how to return DB result

From Dev

Rails 4: model.where.not does not return nil records

From Dev

SQL/Rails return count of unique values from a group of records

From Dev

Rails 5.1 (postgresql): efficient DB query to select parent records and filtered children records

From Dev

How to return no records found from a stored procedure

From Dev

How to return all records from all tables?

From Dev

how to return number of records as a part of a select statement?

From Dev

How to return only records after certain character?

From Dev

How to return records from database using javalite?

From Dev

Rails Activerecord: How to exclude records with multiple associated records

From Dev

How do I return a pointer to something in the middle of a char array?

From Dev

How do I return a pointer to something in the middle of a char array?

From Dev

In Rails 4.1, how to find records by enum symbol?

From Dev

How to create a where clause that returns no records in Rails?

Related Related

  1. 1

    How to find index of array of records return from database in rails?

  2. 2

    Rails nested fields_for duplicate records in DB

  3. 3

    How to sort DB records by parent

  4. 4

    Rails like query return records if posted empty

  5. 5

    How to return response to client in the middle of Promise?

  6. 6

    How to return response to client in the middle of Promise?

  7. 7

    How can I get all records that return True in a model function in a rails app?

  8. 8

    How to show unique records in Rails?

  9. 9

    rails how to find with no associated records

  10. 10

    How to prevent duplicate records in Rails

  11. 11

    MongoDB Java Driver: Return a List of DB Records as a Single Object

  12. 12

    Rails 4: dashboard/analytics and querying ALL records in DB

  13. 13

    How to insert batch of 1000 records into db?

  14. 14

    How to calculate a lot of records in DB with reasonable time

  15. 15

    How to sort mongo db records in mule

  16. 16

    FuelPHP - how to return DB result

  17. 17

    Rails 4: model.where.not does not return nil records

  18. 18

    SQL/Rails return count of unique values from a group of records

  19. 19

    Rails 5.1 (postgresql): efficient DB query to select parent records and filtered children records

  20. 20

    How to return no records found from a stored procedure

  21. 21

    How to return all records from all tables?

  22. 22

    how to return number of records as a part of a select statement?

  23. 23

    How to return only records after certain character?

  24. 24

    How to return records from database using javalite?

  25. 25

    Rails Activerecord: How to exclude records with multiple associated records

  26. 26

    How do I return a pointer to something in the middle of a char array?

  27. 27

    How do I return a pointer to something in the middle of a char array?

  28. 28

    In Rails 4.1, how to find records by enum symbol?

  29. 29

    How to create a where clause that returns no records in Rails?

HotTag

Archive