我決定製作一個RegistrationsController,這樣我就可以將用戶註冊到特定的頁面。唯一的問題是,用戶甚至不會創建,因爲我得到的錯誤:未知的操作:無法爲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
這是怎麼回事?這是如何修復的?
UPDATE
我把create
行動protected
之外,但現在我得到一個Missing template registrations/create
。刪除操作會將我帶回Unknown action: create
。
我甚至沒有看到這種繼承。我也拿走了'redirect_to',因爲這給了雙重渲染錯誤。謝謝。 – LearningRoR