Andrew Neil wrote:
I've just been working on an extension for accessing neighbouring
sibling pages[1], and I found that the following does not work:
tag.locals.page.siblings.find(...)
when you call find() on the siblings, you are actually calling the
method from Ruby's enumerable module, rather than from
ActiveRecord::Base. So in actual fact, it is necessary to call instead:
tag.locals.page.parent.children.find(...)
which still uses ActiveRecord::Base.find(). If you need to exclude the
current page from the result set, you could do so by passing a condition:
:conditions => ["id != ?", tag.locals.page.id]
or something similar. There was a discussion on why find() behaves
differently in each situation a few days ago, but it was on the
[Radiant-dev] list (google groups).
Drew
[1]:http://github.com/nelstrom/radiant-sibling-tags-extension/tree/master
Thanks for the detailed information, Drew. It'll take a while for me to
get through it and to see how it applies to my case. I think I might
need it, but there are ways in my case that I could avoid the hassle.
Let's see which way it goes.
Cheers,
Mohit.
9/1/2008 | 12:36 AM.
_______________________________________________
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant