A possible solution would be the children:each to count the number of
children pages and automatically set it as the value for the limit
param.

I think it would be a very fast and easy solution.


Be Radiant!

Gabriel



2008/9/27 Andrew Neil <[EMAIL PROTECTED]>:
>
>>> Supose I've got 6 children pages, if I write:
>>>
>>>  <r:children:each offset="3">...</r:childen:each>
>>>
>>> it behaves like a pure
>>>
>>>  <r:children:each>...</r:childen:each>
>>>
>>> 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:
>
>
>  
> http://github.com/radiant/radiant/tree/master/spec/models/standard_tags_spec.rb#L90-96
>
> 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?
>
> Drew
> _______________________________________________
> Radiant mailing list
> Post:   Radiant@radiantcms.org
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>
_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to