Strategy for partials needed--DRYing up list-generating code

Hey All,

I’m fighting the urge to just copy/paste view template code & would like
advice on a better strategy.

Consider this model:

status *
funder *
funding_mechanism *

Where the *'d attributes are references to other models. I want to
generate tables listing projects in all of these views:

  1. projects/index
  2. statuses/4/show
  3. funders/2/show
  4. funding_mechanisms/4/show

For #1, I want to show all of the columns of the projects, but for the
others, I want to leave out whichever column is redundant given the
thing I’m "show"ing. So for instance, say /statuses/4 is the ‘active’
status. I want to caption my table “Projects that are currently
Active”, and then show all of the project columns except for status.
Likewise, for funders/2 I want a caption “Projects funded by NCI”, and
to show all columns except for funder.

Optimally, this would all be in a single partial that would morph
depending on the context from which I called it. Is there a way to
write that partial w/out making it a hell-broth of if/then statements?
Or is that just a butt-kicking I’ve got to take?



Roy P.
Research Analyst/Programmer
Group Health Center For Health Studies (Cancer Research Network)
(206) 287-2078
Google Talk: rpardee