Forum: Ruby on Rails Displaying view when using :order in find

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
D66694bbc7619203377bd9c9b7b9f14a?d=identicon&s=25 David (Guest)
on 2007-01-22 17:40
I have a model entity called Project that can have one of three priority
states: high (1), medium (2), low (3). What I want to do is show all
ongoing projects from high -- low priority.

@projects = Project.find(:all, :conditions => ["status = 'ongoing'"],
:order => "priority asc")

My view looks like this:

<div id="project_list">
<% unless @projects.empty? %>
<%= render(:partial => "project", :collection => @projects) %>
<% else %>
<p>No projects have been created yet.</p>
<% end %>

The _project partial simply spits out the details for an individual
project. So how do I display projects like this:

1. High Priority
--- list of high projects
2. Medium Priority
--- list of medium priority projects
3. Low Priority
--- list of low priority projects

Thanks for the help!
This topic is locked and can not be replied to.