Let’s say I have:
map.resources :teams do |team|
team.resources :squads, :shallow => true
When I want to generate a form_for a squad, I need both the team and
squad for new/create, but only the squad for edit.
This means I need:
This seems not very dry. Is there a more idiomatic way of doing this?
Right now, I’ve abbreviated to:
form_for(team = team ? [team, squad] : squad)
(the team=team assignment makes sure there is no error if team is not