title: How to fix "undefined method `key?'" in Rails with Grape
body: <p>I'm creating an API with Ruby on Rails. I use the gem 'grape' to provide the api to the consumer and 'spyke' to receive data from another api. I manipulate and enrich the data I receive from spyke and then pass it on to grape.<br>
  The problem is, that I receive an error: <code>undefined method key?</code>.</p>
  
  <p>I've already checked the data I receive from spyke. The data seems ok (I don't receive an array, I get a Hash). I've printed it with <code>puts result</code> and <code>result.class</code> (result being the data spyke receives).<br>
  I've googled the error message <code>undefined method key?</code>. I tried all "solutions" provided by stackoverflow and other resources. None of them worked. I don't even know where the error is originated exactly.</p>
  
  <pre class="lang-rb prettyprint-override"><code>resource :clusters do
    route_param :cluster_id do
      resource :stats do
        params do
          requires :node, type: String, desc: 'Node name.'
        end
        route_param :node do
          get do
            present StatsNode.where(cluster_id: params[:cluster_id], node: params[:node]), with: StatsNodeEntity
          end
        end
      end
    end
  end
  </code></pre>
  
  <p>I don't know if this is important, but when I raise a string <code>raise 'test'</code> before the line <code>present StatsNode.where...</code>, the message <code>{"response_type":"error","response":"asdf"}</code> appears as the response. If I raise the string after the <code>present</code> line, then the initial error message appears.</p>
  
  <p>The exact message reads: <code>{"response_type":"error","response":"undefined method key?' for [\"_nodes\", {\"total\"=\u003e1, \"successful\"=\u003e1, \"failed\"=\u003e0}]:Array"}</code></p>
  
  <p>I expect, that the api returns a json with the data and not with the error message.<br>
  Where is the error message from and how can I fix this problem?</p>
  
  <p><strong>EDIT:</strong><br>
  I'm using:<br>
  - Ruby 2.5.5<br>
  - Rails 5.2.3<br>
  - spyke latest<br>
  - grape latest<br>
  - grape-entity latest  </p>