title: How can the same request by interpreted as JSON and as */* in Rails?
body: <p><strong>note:</strong> the gist of the question is in the first update below</p>
  
  <p>I'm maintaing a rails project and I noticed that if I do a <code>GET "/request/past_list"</code> I'm routed to <code>RequestController#show</code></p>
  
  <p>in <code>routes.rb</code> I got:</p>
  
  <pre><code>get '/request/past_list', to: 'request#past_list'
  get '/request/:id', to: 'request#show'
  </code></pre>
  
  <p>and running <code>rake routes</code> I get (predictably):</p>
  
  <pre><code>request_past_list GET     /request/past_list(.:format)     request#past_list
                    GET     /request/:id(.:format)           request#show
  </code></pre>
  
  <p>So i'm wondering why is rails thinking that my <code>past_list</code> string in the url is actually an <code>:id</code>? </p>
  
  <p>for now this is the workaround I implemented:</p>
  
  <pre><code>def show
    if ((params[:id]).is_a? String and (params[:id].eql? "past_list"))
      past_list  
    else
      ..
  </code></pre>
  
  <p>but i'm already having trouble sleeping at night because of it.. i'm hoping to know what's really going on to rest my conscience</p>
  
  <p>p.s. this is what the network request looks like on chrome dev tools, just in case if there is some detail that may raise a red flag:</p>
  
  <p><img src="https://i.stack.imgur.com/0o4Ct.png" alt="enter image description here"></p>
  
  <p><strong>update:</strong> i noticed a difference between how the request is interpreted in my current code:</p>
  
  <pre><code>Started GET "/request/past_list" for 127.0.0.1 at 2014-02-13 15:41:14 +0200
  Processing by RequestController#show as JSON
  </code></pre>
  
  <p>and the old working one i dug up from git history:</p>
  
  <pre><code>Started GET "/request/past_list" for 127.0.0.1 at 2014-02-13 15:43:40 +0200
  Processing by RequestController#past_list as */*
  </code></pre>
  
  <p>the thing is the old working code has the exact same routes.rb file.. no changes there!</p>
  
  <p>so i guess it's a difference between interpreting the request as <code>JSON</code> and as <code>*/*</code>..</p>
  
  <p><strong>second update:</strong>
  here are two questions related to this <code>*/*</code> business:
  <a href="https://stackoverflow.com/questions/20977462/when-do-rails-controllers-render-as-js-html-or-q">When do Rails controllers render as JS, HTML, or &#39;q&#39;?</a>
  and 
  <a href="https://stackoverflow.com/questions/11378626/rails-3-processing-by?rq=1">Rails 3 Processing by */*</a></p>