title: How can url encoding be managed with ActiveResource?
body: <p>Is there a way to manage URL encoding with ActiveResource? Specifically I am looking for a way to pass an email address as a parameter.  </p>
  
  <p>Currently my query fails as the <code>@</code> symbol gets URL encoded to <code>%40</code>, causing the lookup on the remote app to fail.</p>
  
  <p>For example, the following query on the ActiveResource model <code>Person</code>…</p>
  
  <pre><code>Person.all(:from =&gt; :remote_find_by_email, :params =&gt; {:email =&gt; "john@example.com")
  </code></pre>
  
  <p>Produces the following URL</p>
  
  <p><code>http://example.com/people/remote_find_by_email.xml?email=john%40example.com</code></p>
  
  <p>Alternately, is there something the remote app should be doing to decode the parameter before performing the lookup?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Thanks to <a href="https://stackoverflow.com/users/526918/eks">eks</a>, I added the following method and before filter to the controller on the remote app:</p>
  
  <pre><code>before_filter :cgi_unescape_params, :only =&gt; [:remote_find_by_email]
  
  private
  
    def cgi_unescape_params
      params.each { |k, v| params[k] = CGI.unescape(v) }
    end
  </code></pre>