Reputation: 2906
I have the two Ruby on Rails models SafetyTest
and TeamDue
, and want to create a partial called _seasonal.html.erb
that can work with either models.
The real problem is adding a link to create a new instance. For example, it would be this code for just SafetyTest
:
<%= link_to new_safety_test_path %>
Now I want to be able to specify in my view, when I'm rendering _seasonal.html.erb
, whether I want such a link for SafetyTest
or TeamDue
. I'm not sure what local to pass to this partial so that it creates the right new
link without making a mess.
How should I go about doing this?
Upvotes: 1
Views: 87