title: Ruby on Rails link_to With put Method
body: <p>I'm new to Rails, and I'm trying to use the link_to helper to create a link that issues a PUT request instead of a GET request. Specifically, I'm trying to create a link that activates a user's account in my app from the admin's panel. I'm using Rails 3.0.5.</p>
  
  <p>My routes.rb file has:</p>
  
  <pre><code>match '/admin/users/:id/activate' =&gt; 'admin#activate_user',
    :action =&gt; :activate_user, :via =&gt; :put
  </code></pre>
  
  <p>My view has:</p>
  
  <pre><code>link_to 'Activate', :action =&gt; :activate_user, :id =&gt; user.id, :method =&gt; :put
  </code></pre>
  
  <p>However this generates the URL (for example) <code>/admin/users/7/activate?method=put</code> with the source code <code>&lt;a href="/admin/users/7/activate?method=put"&gt;Activate&lt;/a&gt;</code>.</p>
  
  <p>I'd like to generate, instead, <code>&lt;a href = "/admin/users/7/activate" data-method="put"&gt;Activate&lt;/a&gt;</code></p>
  
  <p>I realize I could use button_to, but I've been wrestling with this issue for a while and I'm confused why I'm seeing this behavior, when other tutorials say that what I'm doing should be valid. How can I go about creating a link_to helper with the behavior I want?</p>