我是Rails的新手 - 使用Rails 4 final和devise 3.0.0rc(rails 4兼容).我已正确配置并且注册工作正常,但是在某些时候我开始获取未经许可的参数:first_name,last_name在尝试创建新用户时出错(或编辑现有用户的配置文件).关于这个主题有一些类似的问题,但对于不支持的Devise版本 - 我的配置最初工作正常.
Processing by Devise::RegistrationsController#create as HTML
Parameters: {"utf8"=>"?", "authenticity_token"=>"+DG4aeMPteQ4Mq9pPJ2JaitTVgp0NCW9nXi2qSv23zw=", "user"=>{"first_name"=>"John", "last_name"=>"Kenn", "email"=>"me1@email.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign Up"}
Unpermitted parameters: first_name, last_name
(0.2ms) BEGIN
User Exists (0.4ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'me1@email.com' LIMIT 1
(0.2ms) ROLLBACK
Run Code Online (Sandbox Code Playgroud)
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, …Run Code Online (Sandbox Code Playgroud)