rails 5 NosethodError in RegistrationsController #new undefined method

时间:2016-09-23 23:34:22

标签: ruby-on-rails controller

在课程项目中工作并使用rails 5但是在RegistrationsController#new中的NoMethodError中实现此操作后,课程不会使用rails 5接收此错误 未定义的方法`<<&#;为零:NilClass

之前是

:class ApplicationController<的ActionController ::基

  class RegistrationsController < ApplicationController

  before_action :configure_permitted_paramters, if: :devise_controller?

  protected
    def configure_permitted_paramters
        devise_parameter_sanitizer.permit(:sign_up) << :fullname
        devise_parameter_sanitizer.permit(:account_update) << :fullname << :cell_number << :license_plate_number << :vehicle_description << :email << :password
       end
   end

我的路线改为此问题也是问题的一部分?

Rails.application.routes.draw do

  root 'pages#home'

  devise_for :users, 
    path => '', 
    :path_names => {:sign_in => 'login', :sign_out => 'logout', :edit => 'profile'},
controllers => {:omniauth_callbacks => 'omniauth_callbacks',
    :registrations => 'registrations'
                                                        }

  resources :users, only: [:show]

end

1 个答案:

答案 0 :(得分:0)

您的注册控制器正在重新定义应用程序控制器,而不是定义注册控制器。请尝试以下方法:

class RegistrationsController < ApplicationController
  def new
  end
end