简体   繁体   中英

Rails 3: Devise overriding sign_up controller woes

Referenced the online documents for Devise but my override is still not working. Any one got any suggestions why not? It just goes to the root after sign in. Sign up works though.

Routes:

  root :to => 'pages#index'
  get "pages/index"

  devise_for :users, :path => 'accounts', :controllers => { :registrations => "registrations" }

  match 'profile' => 'profiles#show', :as => 'current_profile'
  match 'profile/edit' => 'profiles#edit', :as => 'edit_current_profile'
  put 'profile' => 'profiles#update'

  resources :users do
    resources :profiles 
  end

Registration Controller:

class RegistrationsController < Devise::RegistrationsController

  protected

  def after_sign_up_path_for(resource)
     edit_current_profile_path
  end

  def after_sign_in_path_for(resource)
     current_profile_path
  end

end
  def after_sign_in_path_for(resource)
     current_profile_path
  end

This goes in the application_controller, not the override class.

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