Rails 3:设计覆盖sign_up控制器的困境

时间:2012-09-13 06:31:35

标签: ruby-on-rails ruby-on-rails-3 devise routes

参考了Devise的在线文档,但我的覆盖仍然无效。任何人都有任何建议为什么不呢?它只是在登录后进入根目录。虽然注册有效。

路线:

  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

注册控制器:

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

1 个答案:

答案 0 :(得分:0)

  def after_sign_in_path_for(resource)
     current_profile_path
  end

这是在application_controller中,而不是override类。