生成设计控制器时的路由错误

时间:2016-05-11 00:54:33

标签: ruby-on-rails model-view-controller devise routes

当我运行服务器时,当我尝试访问注册页面时出现uninitialized constant Customers::RegistrationController错误

这是我生成的控制器:

class Customers::RegistrationsController < Devise::RegistrationsController
# before_action :configure_sign_up_params, only: [:create]
# before_action :configure_account_update_params, only: [:update]

  # GET /resource/sign_up
   def new
     super
   end

  # POST /resource
  # def create
  #   super
  # end

  # GET /resource/edit
  # def edit
  #   super
  # end

  # PUT /resource
  # def update
  #   super
  # end

  # DELETE /resource
  # def destroy
  #   super
  # end

  # GET /resource/cancel
  # Forces the session data which is usually expired after sign
  # in to be expired now. This is useful if the user wants to
  # cancel oauth signing in/up in the middle of the process,
  # removing all OAuth session data.
  # def cancel
  #   super
  # end

  # protected

  # If you have extra params to permit, append them to the sanitizer.
  # def configure_sign_up_params
  #   devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])
  # end

  # If you have extra params to permit, append them to the sanitizer.
  # def configure_account_update_params
  #   devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])
  # end

  # The path used after sign up.
  # def after_sign_up_path_for(resource)
  #   super(resource)
  # end

  # The path used after sign up for inactive accounts.
  # def after_inactive_sign_up_path_for(resource)
  #   super(resource)
  # end
end

这里是客户模型的所有路线:

new_customer_session GET    /customers/sign_in(.:format)          customers/sessions#new
            customer_session POST   /customers/sign_in(.:format)          customers/sessions#create
    destroy_customer_session DELETE /customers/sign_out(.:format)         customers/sessions#destroy
           customer_password POST   /customers/password(.:format)         devise/passwords#create
       new_customer_password GET    /customers/password/new(.:format)     devise/passwords#new
      edit_customer_password GET    /customers/password/edit(.:format)    devise/passwords#edit
                             PATCH  /customers/password(.:format)         devise/passwords#update
                             PUT    /customers/password(.:format)         devise/passwords#update
cancel_customer_registration GET    /customers/cancel(.:format)           customers/registration#cancel
       customer_registration POST   /customers(.:format)                  customers/registration#create
   new_customer_registration GET    /customers/sign_up(.:format)          customers/registration#new
  edit_customer_registration GET    /customers/edit(.:format)             customers/registration#edit
                             PATCH  /customers(.:format)                  customers/registration#update
                             PUT    /customers(.:format)                  customers/registration#update
                             DELETE /customers(.:format)                  customers/registration#destroy
       customer_confirmation POST   /customers/confirmation(.:format)     devise/confirmations#create
   new_customer_confirmation GET    /customers/confirmation/new(.:format) devise/confirmations#new
                             GET    /customers/confirmation(.:format)     devise/confirmations#show

在我的路由文件中,我写了devise_for :customers, :controllers => { registrations: "customers/registration" }

我不知道为什么我会收到此错误,我生成模型时会自动生成路径

enter image description here

0 个答案:

没有答案