offset(value) public

Specifies the number of rows to skip before returning rows.

User.offset(10) # generated SQL has "OFFSET 10"

Should be used with order.

User.offset(10).order("name ASC")
Show source
Register or log in to add new notes.
October 22, 2010
1 thank

doesn't work directly off a class.

for some reason this method only works on relation objects, not directly on an AR class.

# doesn't work

# does work

there’s an closed ticket for this here http://rails.lighthouseapp.com/projects/8994/tickets/5688-modeloffsetxlimitx-unknown-offset-method-exception and should be resolved in the next release of rails.