One model and Many edit views
- by user179438
Hi,
I have a model I named User, and I want use two different Views to edit it: the usual edit view and another view I called edit_profile.
I had no problem in creating routing, controller and views: I added edit_profile and update_profile views, and I added on routes.rb the line:
map.resources :users ,:member => {:edit_profile => :get, :update_profile => :put}
The problem is: when I submit the form in edit_profile and some error occur in some input fields, rails reload the edit_path page instead of edit_profile_path page !
This is the form on edit_profile.html.erb
form_for(:user, @user, :url => {:action => :update_profile}, :html => { :method => :put} ) do |f|
= f.text_field :description
= f.text_area :description
= f.error_message_on :description
....
....
= f.submit 'Update profile'
After clicking Update profile, if input errors occur I want to show edit_profile view instead of edit view
Do You have some ideas ?
many thanks