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

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

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