title: How do you use Rails 5.2 wrap_parameters?
body: <p>I have a Rails 5.2 app built as API only. I am using Postman to test the endpoints. Currently, I am wrapping all of my JSON POSTS with the root element in order to get it to pass the 'strong parameters'. According to the Rails docs, however, with <code>wrap_parameters</code> set to accept JSON, I shouldn't have to be doing this, however, my POSTs fail if I don't. What am I doing wrong?</p>
  
  <hr>
  
  <pre><code># users_controller.rb
  
  class UsersController &lt; ApplicationController
    before_action :set_user, only: [:show, :update, :destroy]
  
    .....
  
    # POST /users
    def create
      @user = User.new(user_params)
  
      if @user.save
        render json: @user, status: :created, location: @user
      else
        render json: @user.errors, status: :unprocessable_entity
      end
    end
  
    .....
  
    private
    .....
  
      # Only allow a trusted parameter "white list" through.
      def user_params
        params.require(:user).permit(:email, :password, :is_admin, :is_agent)
      end
  end
  </code></pre>
  
  <hr>
  
  <pre><code># config/initializers/wrap_parameters.rb
  
  ActiveSupport.on_load(:action_controller) do
    wrap_parameters format: [:json]
  end
  </code></pre>
  
  <hr>
  
  <p><a href="https://i.stack.imgur.com/aeblP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/aeblP.png" alt="enter image description here"></a></p>
  
  <p>If I wrap the JSON in a <code>user</code> it works just fine, however, according to the Rails docs, I shouldn't have to do that.</p>
  
  <p><a href="http://api.rubyonrails.org/v5.2.0/classes/ActionController/ParamsWrapper.html" rel="noreferrer">http://api.rubyonrails.org/v5.2.0/classes/ActionController/ParamsWrapper.html</a></p>
  
  <p>I have tried adding <code>wrap_parameters User</code> and <code>wrap_parameters :user</code> and <code>wrap_parameters format: [:json]</code> directly to the <code>users_controller.rb</code> but that doesn't do anything.</p>
  
  <p>What am I doing wrong?</p>