title: Trying to create a POST request but getting No route matches [GET]
body: <p>I'm trying to do something similar to <a href="http://railscasts.com/episodes/255-undo-with-paper-trail" rel="nofollow">Railscasts #255</a> but I'm getting a No Route error:</p>
  
  <p>In Ryan's <code>routes.rb</code> file:</p>
  
  <pre><code>    post "versions/:id/revert" =&gt; "versions#revert", :as =&gt; "revert_version"
  </code></pre>
  
  <p>In in the controller where he uses the route, <code>versions_controller.rb</code></p>
  
  <pre><code>    link = view_context.link_to(link_name, revert_version_path(@version.next, :redo =&gt; !params[:redo]), :method =&gt; :post)
      redirect_to :back, :notice =&gt; "Undid #{@version.event}. #{link}"
  </code></pre>
  
  <p>In my <code>routes.rb</code></p>
  
  <pre><code>    post "/approve/:id" =&gt; "listings#approve", :as =&gt; "listing_approve"
  </code></pre>
  
  <p>and view where I use my link: </p>
  
  <pre><code>    &lt;%= link_to 'Approve Content', listing_approve_path(@listing), :method =&gt; :post %&gt;
  </code></pre>
  
  <p>My tests return to me a <code>ActionController::RoutingError: No route matches [GET] "/approve/1"</code></p>
  
  <p>If I leave the method as a GET everything works..  Using rails 3.1.0rc5.  Any guidance as to what I'm doing wrong here would be very much appreciated..</p>
  
  <p>EDIT: routes.rb file (the last line is set as <code>match</code> right now to work)</p>
  
  <pre><code>RLR::Application.routes.draw do
  
    root :to =&gt; "home#index"
  
    devise_for :users, :controllers =&gt; { :registrations =&gt; "registrations" }
    devise_for :users
  
    match '/user' =&gt; "layouts#index", :as =&gt; :user_root
  
    resources :users, :only =&gt; :show
    resources :layouts, :only =&gt; [:index, :show]
    resources :listings
    resources :features
    resources :orders
  
    match "/preview/:id" =&gt; "listings#preview", :as =&gt; "listing_preview", :via =&gt; "get"
    match "/approve/:id" =&gt; "listings#approve", :as =&gt; "listing_approve"
  
  end
  </code></pre>