Rails 4 Strong parameters : permit all attributes?

后端 未结 4 2015
日久生厌
日久生厌 2020-12-07 18:37

I\'m building a web app with Rails 4 strong parameters.

When building the admin back office controllers, I wonder what is the best way to permit all the model attrib

4条回答
  •  一生所求
    2020-12-07 19:10

    Just in case someone need it for Rails 6, without even a model linked to your controller, you can use:

    before_action :accept_all_params
    
    private
    
    def accept_all_params
      params.permit!
    end
    

    And done, now you can play with

提交回复
热议问题