Processing by Devise::RegistrationsController#create as HTMLParameters: {"utf8"=>"✓","authenticity_token"=>"+DG4aeMPteQ4Mq9pPJ2JaitTVgp0NCW9nXi2qSv23zw=","user"=>{"first_name"=>"John","last_name"=>"Kenn","email"=>"[email protected]","password"=>"[FILTERED]","password_confirmation"=>"[FILTERED]"},"commit"=>"Sign Up"}Unpermitted parameters: first_name,last_name(0.2ms) BEGINUser Exists (0.4ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = '[email protected]' liMIT 1(0.2ms) RolLBACK
user.rb
class User < ActiveRecord::Base has_many :jobrecords,dependent: :destroy # after_create :send_welcome_email # Include default devise modules. Others available are: # :token_authenticatable,:encryptable,:confirmable,:lockable,:timeoutable and :omniauthable devise :database_authenticatable,:registerable,:omniauthable,:recoverable,:rememberable,:trackable,:valIDatable # Setup accessible (or protected) attributes for your model valIDates :first_name,presence: true valIDates :last_name,presence: true valIDates :email,presence: true attr_accessible :first_name,:last_name,:email,:password,:password_confirmation,:remember_me def self.from_omniauth(auth) where(auth.slice(:provIDer,:uID)).first_or_create do |user| user.provIDer = auth.provIDer user.uID = auth.uID user.first_name = auth.info.nickname user.last_name = auth.info.nickname end end def self.new_with_session(params,session) if session["devise.user_attributes"] new(session["devise.user_attributes"],without_protection: true) do |user| user.attributes = params user.valID? end else super end end def password_required? super && provIDer.blank? end def update_with_password(params,*options) if encrypted_password.blank? update_attributes(params,*options) else super end end private def send_welcome_email UserMailer.signup_confirmation(self).deliver endend
即使之前它正常工作,我尝试在registrations_controller.rb中覆盖sign_up_params,但这不起作用.我仍然可以使用openauth-twitter注册(因为应用程序在通过Twitter注册时不会要求姓或姓).任何帮助表示赞赏.
解决方法 所以,我不知道你是否已经尝试过这个,但我遇到了类似的问题,最后我将’configure_permitted_parameters’方法添加到我的ApplicationController中,并为:sign_up和:account_update添加了一个devise_parameter_sanitizer,每个设计文档: https://github.com/plataformatec/devise#strong-parameters希望如果这不是您所需要的,它将使您朝着正确的方向前进.
总结以上是内存溢出为你收集整理的ruby-on-rails – Rails 4 /设计3.00rc / pg注册/编辑中的“未授权参数”全部内容,希望文章能够帮你解决ruby-on-rails – Rails 4 /设计3.00rc / pg注册/编辑中的“未授权参数”所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)