Hello everyone,

I'm learning RoR by creating a small web app that I use for work. I have
the main model with which is Project(s) which has many Task(s) (of
course belongs to Project) then a few other controller/models below
When I list the tasks, I expect the Project id

def list
  @project = Project.find(params[:id])

in my list.rhtml I currently just show every task with an each.do

<%= @project.task.each do |t| %>
and then the code to display all my fields and records.

So, to make a long story short, I have a field called "Status" which has
a few options, (New, In-Process, On-Hold, Completed). and what I want to
be able to do is just show non completed tasks ie: != Completed)
Then do some more html stuff and have a seperate section later to show
the completed tasks. All with in the list.rhtml

I've tried a few different things I've found around the web, but nothing
seems to work.


BTW I am using V2.0.2 of everything


just do the if conditions inside the do loop

<%= @project.task.each do |t| %>
<% if t.status != “Completed” %>
<% end %>

<% end %>

or you can try like this too inside loop


<%= @project.task.each do |t| %>
<%=t.XXX if t.status != “Completed”%>
<% end %>

Bala wrote:

or you can try like this too inside loop


<%= @project.task.each do |t| %>
    <%=t.XXX if t.status != "Completed"%>
<% end %>

Thanks guys I tried that once, but I forgot the ""quotes around the
Completed. I guess I should go get my eyes checked


<% for task in @project.tasks.select { |t| t.status != “Completed” } %>
#task stuff
<% end %>