I’ve got 2 views that show a tabular listing of my Person objects (one
for people/index, and one for organizations/show). Here’s what the
organizations/show bit looks like:
<% if @organization.people.count > 0 then %>
People from <%= h @organization.name %>
<% end %>
As you can see–I’m starting the table & setting the headings in the
partial-calling template. This meant that when I added an attribute
to my Person class, I had to edit the 2 templates that called the
partial. Not tragic or anything, but I’m guessing not optimal either.
So what’s the DRY way to do this? Am I right that by the time we’re
in the partial template we’re iterating through a collection, and it’s
too late to do anything pre-amble-y? Maybe a helper?
Also–bonus question: is there a graceful way of suppressing the
printout of the Organization column when the partial is called from
organizations/show? It’s really redundant in that case…