I am looking for the most effective way to display categorized pages.
Page model:
acts_as_tree
belongs_to :theme
(has attribute “title”)
Theme model:
has_many :pages
(has attribute “name”)
I’d like to display all the children (titles) of the current page but
grouping these pages in themes they belong to.
I imagine that code “extracts” unique themes from @page.children and
then iterates through these themes and displays just pages (titles) that
are children of the current page and belong to proper themes.
I imagine that code “extracts” unique themes from @page.children and
then iterates through these themes and displays just pages (titles) that
are children of the current page and belong to proper themes.
You might want to look at named_scopes… this sounds like a candidate
for a something like page.theme_ordered_children, rather than just
page.children.