rubyonrailsin

A Ruby and Rails talk

Friday, April 2, 2010


[Rails] Re: Best way of sorting/grouping objects

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

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 %>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment

Subscribe feeds via e-mail

Blog Archive