Sorted it out using interations
<% @material_types.each do |mt| %>
<h2> <%= mt.name %> </h2>
<p>Number of <%= mt.name %> types: <%=
Material.find(:all, :conditions => {:material_type =>
mt.material}).count %> </p>
<% if Material.find(:all, :conditions => {:material_type
=> mt.material}).count > 0 %>
<table class="info" border="0" cellpadding="5"
cellspacing="1">
<tr class="header">
<th>No</th> <th>Name</th> <th>Moisture</th>
<th>Dose Size</th> <th>Content</th> <th>MATERIAL EDITOR</th>
</tr>
<% Material.find(:all, :conditions =>
{:material_type => mt.material}).each do |mat| %>
..list all the materials
It works! But this does feel like RAILS solutions, does anyone know
how to put the Material.find stuff in the controller and just call
the .each and .count methods?
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.