Rails 4 - strong parameters concept involvement in spree-2.1

后端 未结 2 655
谎友^
谎友^ 2021-02-09 15:27

How to add new fields for spree::user in Spree-2.1 + Rails4 ?

Like my old customization: ==========================

Spree::User.class_eval do

a         


        
2条回答
  •  一生所求
    2021-02-09 16:27

    A change was recently made to spree_auth_devise which will allow you to set permitted attributes for Spree::User.

    This is the relevant line of code: https://github.com/spree/spree_auth_devise/blob/ac27effb5998e5875261f08655e442461a031370/app/controllers/spree/user_registrations_controller.rb#L69

    You'll need to add f_name and l_name to Spree::PermittedAttributes.user_attributes like so:

    # in an initializer
    Spree::PermittedAttributes.user_attributes << :f_name
    Spree::PermittedAttributes.user_attributes << :l_name
    

    More information about Spree::PermittedAttributes can be found in this pull request:

    https://github.com/spree/spree/pull/3566

提交回复
热议问题