Rails 4/Devise/MongoDB: “Unpermitted parameters” using custom properties and strong parameters

前端 未结 4 1348
南方客
南方客 2021-01-02 19:36

Trying to add a nested custom attribute, Profile (a Mongoid document), to my devise User class. When the Devise registration form is submit

4条回答
  •  迷失自我
    2021-01-02 20:18

    I had the exact same issue and overriding sign_up_params did work for me

    def sign_up_params
       params.require(:user).permit(:email, :password, :password_confirmation, :other, :etc)
    end
    

    of course, the difference is in that mine are just scalar values, while you're trying to mass assign a relation... I guess that's where you should look for.

    By the way, the documentations is still inexistint in this topic (too new), and code commnents suggest to override devise_parameter_sanitizer, which isn't necessary.

提交回复
热议问题