没有将Symbol隐式转换为Integer

jus*_*ode 3 implicit-conversion devise ruby-on-rails-4

我使用rails 4.0.1和ruby 2.0.0 with devise 3.2.2.当用户尝试编辑他的帐户时,我不断收到此问题.我在application_controller.rb中有我的强参数和一个自定义更新控制器,如下所示:

class RegistrationsController <Devise :: RegistrationsController

def update
    # For Rails 4
    account_update_params = devise_parameter_sanitizer.for(:account_update)
    @user = User.find(current_user.id)
    @user.balanced_associate_token_with_customer(account_update_params)
    if @user.update_with_password(account_update_params)
      set_flash_message :notice, :updated
      # Sign in the user bypassing validation in case his password changed
      sign_in @user, :bypass => true
      redirect_to after_update_path_for(@user)
    else
      render "edit"
    end
end 
Run Code Online (Sandbox Code Playgroud)

protected def after_update_path_for(resource)user_path(resource)end end

从昨天开始我一直在拉我的头发......任何帮助都会受到赞赏.如果您需要更多信息,请告诉我.

编辑:在我注意到错误之前唯一改变的是设计开始在设计初始化文件中请求config.secret_key.

完整跟踪的一部分显示:

devise (3.2.2) lib/devise/models/database_authenticatable.rb:64:in `[]'
devise (3.2.2) lib/devise/models/database_authenticatable.rb:64:in `update_with_password'
app/controllers/registrations_controller.rb:12:in `update'
actionpack (4.0.2) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.0.2) lib/abstract_controller/base.rb:189:in `process_action'
Run Code Online (Sandbox Code Playgroud)

谢谢!

jus*_*ode 6

我在几个小时后解决了这个问题.希望这有助于那里的人.似乎Devise改变了它的文档.无论如何我删除了这一行:

account_update_params = devise_parameter_sanitizer.for(:account_update)

并改变了这一行:

if @ user.update_with_password(account_update_params)

if @ user.update_with_password(devise_parameter_sanitizer.sanitize(:account_update))

一切正常......现在我需要喝一杯.