title: How to get just GET and POST params as hash in Rails?
body: <p>I would like to get any additional <code>GET</code> and <code>POST</code> <strong>params</strong> in Rails without Rails' own additions such as <code>controller</code>, <code>format</code>, etc...</p>
  
  <p><code>params.inspect</code> gave me what I want but it has some keys that Rails adds for me such as <code>controller</code> or <code>format</code>. I only want to get user input <code>GET</code> and <code>POST</code> params as hash. How can I do that? I cannot find anything.</p>
  
  <p><strong>URL:</strong></p>
  
  <p><code>http:/test.com/some/path?query1=1&amp;query2=1</code></p>
  
  <p><strong>Run:</strong></p>
  
  <p><code>puts params.inspect</code></p>
  
  <p><strong>Expected:</strong></p>
  
  <p><code>{"query1"=&gt;"1", "query2"=&gt;"1"}</code></p>
  
  <p><strong>Actual:</strong></p>
  
  <p><code>{"query1"=&gt;"1", "query2"=&gt;"1", "format"=&gt;":json", "controller"=&gt;"get", "action"=&gt;"index", "folder"=&gt;"some/path"}</code></p>
  
  <p>Also this can be combined with POST request. I only want to filter them and only get them as hash.</p>
  
  <p>I execute this from inside of a controller. Rails 5 used.</p>