Hey All,
I’m fighting the urge to just copy/paste view template code & would like
advice on a better strategy.
Consider this model:
Project
name
start_date
status *
funder *
funding_mechanism *
<etc.>
Where the *'d attributes are references to other models. I want to
generate tables listing projects in all of these views:
- projects/index
- statuses/4/show
- funders/2/show
- 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?
Thanks!
-Roy
Roy P.
Research Analyst/Programmer
Group Health Center For Health Studies (Cancer Research Network)
(206) 287-2078
Google Talk: rpardee