title: How to pass parameter in RestClient get request header and to access the parameter in controller
body: <p>I am using RestClient in my ruby on rails app to send a get request to an api of my app like the following:</p>
  
  <pre><code>RestClient.get(url?params1=&lt;val1&gt;&amp;param2=&lt;val2&gt;..)
  </code></pre>
  
  <p>The problem is that I also have to pass the secret API key to access the api in header of the get request. I have no idea<b> how to pass this parameter in header of the request </b>and <b>how to access this param api_key inside my controller to validate the request to get access to that api</b>. So I want something like that:</p>
  
  <pre><code>class StudentsController &lt; ApplicationController
  
   before_filter :validate_access, :only =&gt; [:&lt;api_name&gt;]
  
   private
  
     def validate_access
       .... &lt; I don't have any idea what to write here&gt;
  </code></pre>
  
  <p>In this restrict_access function I want to check the value of api_key in request header to determine whether the request will be given access to that function or not.</p>