ruby - ActiveRecord - getting query results for row N to row N+10 -



ruby - ActiveRecord - getting query results for row N to row N+10 -

i know has been asked before (in fact, i'm pretty sure of it).

suppose have model article, , want find articles fit condition, ordered date.

article.find(:conditions => [some condition], :order => "date asc")

if want 10th 20th rows query, how do activerecord?

i using postgres, if makes difference.

the rails 3 notation be:

article.where(...conditions...).order('date asc').limit(10).offset(10)

what want pagination tool paginator or similar. provide interface show page n instead of having limit , offset calculations yourself.

ruby activerecord

Comments

Popular posts from this blog

javascript - mongodb won't find my schema method in nested container -

r - url in CRAN extension manual -

asp.net - .NET Control.ID property inconsistency -