ruby on rails - devise custom routes -


when user goes

/account/edit

click submit button redirects

/signup

path ? appreciated.

routes

devise_for :users, :skip => [:registrations, :sessions]   'signup' => 'devise/registrations#new', :as => :new_user_registration   post 'signup' => 'devise/registrations#create', :as => :user_registration   'users/cancel' => 'devise/registrations#cancel', :as => :cancel_user_registration   'account/edit' => 'devise/registrations#edit', :as => :edit_user_registration   put 'account' => 'devise/registrations#update'   delete 'users' => 'devise/registrations#destroy'    'signin' => 'devise/sessions#new', :as => :new_user_session   post 'signin' => 'devise/sessions#create', :as => :user_session   'signout' => 'devise/sessions#destroy', :as => :destroy_user_session end 

registrations/edit.html.erb

<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) |f| %> <% if resource.errors.any? %>     <div id="error_explanation">       <ul>       <% resource.errors.full_messages.each |msg| %>         <li><%= msg %></li>       <% end %>       </ul>     </div> <% end %> <div class="field">     <%= f.label :email %><br/>   <%= f.email_field :email %> </div> <div class="field">   <%= f.label :password %><br/>   <%= f.password_field :password %> </div> <div class="field">   <%= f.label :password_confirmation %><br/>   <%= f.password_field :password_confirmation %> </div> <div class="field">   <%= f.label :current_password %><br/>   <%= f.password_field :current_password %> </div> <div class="actions">   <%= f.submit %> </div> <% end %> 

as far know, there 2 possible solutions this.

solution #1:

change line:

post 'signup' => 'devise/registrations#create', :as => :user_registration 

to this:

post 'account' => 'devise/registrations#create', :as => :user_registration 

solution #2:

change line:

put 'account' => 'devise/registrations#update' 

to this:

put 'account' => 'devise/registrations#update', :as => :update_user_registration 

and change form_for url option in view:

form_for(resource, :as => resource_name, :url => update_user_registration_path, :html => { :method => :put }) 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -