我决定制作一个 RegistrationsController,这样我就可以在注册时将用户重定向到特定页面。唯一的问题是用户甚至没有被创建,因为我得到了错误:
Started POST "/users" for 127.0.0.1 at 2012-06-12 14:01:22 -0400
AbstractController::ActionNotFound (The action 'create' could not be found for R
egistrationsController):
我的路线和控制器:
devise_for :users, :controllers => { :registrations => "registrations" }
devise_scope :user do
get "/sign_up" => "devise/registrations#new"
get "/login" => "devise/sessions#new"
get "/log_out" => "devise/sessions#destroy"
get "/account_settings" => "devise/registrations#edit"
get "/forgot_password" => "devise/passwords#new", :as => :new_user_password
get 'users', :to => 'pages#home', :as => :user_root
end
class RegistrationsController < ApplicationController
protected
def after_sign_up_path_for(resource)
redirect_to start_path
end
def create # tried it with this but no luck.
end
end
这里发生了什么?这是如何解决的?
更新
我把create
动作放在外面,protected
但现在我得到了一个Missing template registrations/create
. 删除动作让我回到Unknown action: create
.