title: Rails 5 API POST Create params empty
body: <p>thanks for taking at look at this issue. I'm building an API in Rails 5, and having trouble with the a POST create request. </p>
  
  <p>Basically, my params are empty by the time my API gets them and not sure why. Sending this JSON object with Postman:</p>
  
  <pre><code>{ 
    "battle": {
      "winner_score": 300,
      "loser_score": 3,
      "winner_id": 2,
      "loser_id": 1
    }
  }
  </code></pre>
  
  <p>Here's the relevant controller:</p>
  
  <pre><code>class Api::V1::BattlesController &lt; ApplicationController
  
    protect_from_forgery with: :null_session, if: Proc.new { |c| c.request.format.include? 'application/json' }
    wrap_parameters format: [:json]
  
  
    # POST /battles
    def create
      @battle = Battle.new(battle_params)
  
      if @battle.save
        render json: @battle, status: :created, location: @battle
      else
        render json: @battle.errors, status: :unprocessable_entity
      end
    end
  
    private
  
    # Only allow a trusted parameter "white list" through.
    def battle_params
      binding.pry
      params.permit(:winner_score, :loser_score, :winner_id, :loser_id)
    end
  end
  </code></pre>
  
  <p>When I hit the binding.pry in the battle_params method, the params object is nil:</p>
  
  <pre><code>    50: def battle_params
   =&gt; 51:   binding.pry
      52:   params = params.to_h
      53:   params.permit(:winner_score, :loser_score, :winner_id, :loser_id)
      54: end
  
      params
      =&gt; nil
  </code></pre>
  
  <p>My Postman request gets a response that says .permit is an undefined method on the hash, which I also see in the terminal:</p>
  
  <pre><code>"status":500,"error":"Internal Server Error","exception":"#\u003cNoMethodError: undefined method `permit' for {}:Hash\u003e"
  
  NoMethodError (undefined method `permit' for {}:Hash):
  app/controllers/api/v1/battles_controller.rb:53:in `battle_params'
  </code></pre>
  
  <p>I haven't run across this issue before, so any insight is really appreciated.</p>