title: Appending empty query string param to the URL in Rails
body: <p>Is there a way to append something to the query string with no value set?</p>
  
  <p>I would like to see this kind of URL being generated: <code>http://local/things?magic</code>.</p>
  
  <p>What I'm looking for is when the user goes to <code>http://local/other?magic</code> then every URL in the generated page would contain <code>magic</code> in the end.</p>
  
  <p>Following code is almost a solution but it gives me <code>http://local/things?magic=</code>. There is an extra <code>=</code> that I don't want there.</p>
  
  <pre><code>def default_url_options(options)
      if params.has_key?("magic")
          { :magic =&gt; "" }
      end
  end
  </code></pre>
  
  <p>Setting <code>{ :magic =&gt; nil }</code> will remove the magic entirely from the generated URLs.</p>