Form_for with nested shallow route

Let’s say I have:

map.resources :teams do |team|
team.resources :squads, :shallow => true
end

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:

edit:
form_for(squad)

new:
form_for([team, squad])

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
defined)