I have a Model called Page, which has a column called page_type.
I want to display all pages by page type (which can change/be added).
What is the best way of doing this? I was, in the view looping through
each page_type, then doing an SQL search for a Page with that
page_type. But I don't want to call Models through the View..
That could work. But I need it to order by page_order also. I would
like to group them into 3 groups then sort them by that. In the end I
want it to look something like this in html...
TYPE ONE
Page 1
Page 2
TYPE TWO
Page 1
Page 2
Before I was doing something like this (I had an array of each page
type called page_types):
<% page_types.each do |t| %>
<%= t %>'s
<% Page.find(:all, :conditions=>{:page_type=>t}, :order=>position
%>
etc.
<% end %>
<% end %>
Thanks Angelo! That is a great idea. In the long run that would
probably make more sense. But in the meantime I'll look into
the :group fix. What exactly does that do?