In Oracle i would write that as follows:
YourModel.find(:conditions => 'MOD(ROWNUM,3) = 0')
this has the advantage that the filter happens at the database, so not everything is retrieved.
In PostgreSQL this is called ROW_NUMBER
(actually that is the SQL-standard). In MySQL this is not supported.
In mysql you can mimic rownum using SELECT @rownum:=@rownum+1 rownum, t.* FROM (SELECT @rownum:=0) r, mytable t;
. So i guess something like
Bar.find_by_sql("select * from (SELECT @rownum:=@rownum+1 rownum, t.* FROM (SELECT @rownum:=0) r, mytable t) where mod(rownum,3) = 0")
should work.