我不知道为什么,但下面的代码只是停止工作(我甚至没有注意到它是怎么发生的)设计:未经许可参数
的routes.rb
devise_for :users, components: {registrations: 'registrations', sessions: 'sessions'}
registations_controller .RB
class RegistrationsController < Devise::RegistrationsController
before_filter :configure_permitted_parameters
def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up).push(:name, :surname, :username, :email, :avatar)
devise_parameter_sanitizer.for(:account_update).push(:name, :surname, :email, :avatar)
end
end
正如我所说的,everyting工作过罚款,但现在我越来越:
Processing by Devise::RegistrationsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"lvuPOmTRqv6XUQ/O1g4Q9VNvzD7DgGCHocY/OlAvKHEIvWAHvlS982hxSZZzzAESCpmL5QTUcTLw/c9ME/sUFQ==", "user"=>{"name"=>"John", "surname"=>"Doe", "username"=>"foobar", "email"=>"[email protected]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Register"}
Unpermitted parameters: name, surname, email
Cofiguration:
- 的Rails 4.2.5
- 设计3.5.6
PS:现在我finnaly明白我为什么要支付我的代码与单元测试和使用特拉维斯CI
我帮了我。但为什么?之前的代码发生了什么? – Viktor
https://github.com/plataformatec/devise请检阅它。这可能会帮助你。 –
从4.1开始,'for'方法已被弃用。用这个代替: – dexter