My Rails views and controllers are littered with redirect_to, link_to, and form_for method calls. Sometimes link_to and <
Here is a safe clean way to have it work in forms and throughout your application that we use.
resources :districts
resources :district_counties, controller: 'districts', type: 'County'
resources :district_cities, controller: 'districts', type: 'City'
Then I have in my form. The added piece for this is the as: :district.
= form_for(@district, as: :district, html: { class: "form-horizontal", role: "form" }) do |f|
Hope this helps.