简体   繁体   中英

form_for model update

I have nested resources organized in the following manner:

resources :users do    
    resource :profile, :controller => "profiles" do
      resource :location
end

In the view part, I want an unique form_for that is able to handle (update/create) the profile model and the location as well in once. Is it possible ? What is the code ? How to organize the controller that will receive multiple models in once ?

Tnx

Check out this Railscast to implement the form: Nested forms

And if you want it, this for make it more dinamyc: Dinamyc nested forms

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM