Supose I've got 6 children pages, if I write:

  <r:children:each offset="3">...</r:childen:each>

it behaves like a pure


showing all 6 pages.

But if I write:

  <r:children:each limit="6" offset="3">...</r:childen:each>

it works correctly, showing only the last three.

Is it correct?

I recently ran into this confusing problem too.

Here are the relevant specs:

which test children:each given a limit, or an offset with a limit. But there is no spec for an offset without a limit. When I saw this, I tried adding a limit to my children:each tag (which had only an offset), and reached the same conclusion as Gabriel.

Page.find(:all, :offset => 3) returns all pages.
This is essentially what the children:each does (scoped to a particular page)
If this is incorrect behavior, it's with ActiveRecord::Base

As Jim points out, the behaviour is defined at the level of ActiveRecord.

I wonder if an interim solution might be for the children:each tag to set a default limit of a very high number (such as 10,000). This way, you could call:

  <r:children:each offset="3">...</r:childen:each>

which would run something like:

Page.find(:all, :offset => 3, :limit => 10000)

and produce the expected effect of returning all pages after the first 3. (As long as you have less than 10000 pages!)

Any thoughts?

Radiant mailing list

Reply via email to