title: I am defining post method in link_to but i am getting routing error for get , i have defined a post route
body: <p>I have defined a post route in my routes.rb and using it in <code>link_to</code> helper. When I click the link generated by <code>link_to</code> helper, I am getting an error that is suppose to be an error for get method.</p>
  
  <pre><code>Started GET "/wallpapers/1/like?like=true" for 127.0.0.1 at 2017-08-03 12:51:59 +0530
  
  ActionController::RoutingError (No route matches [GET] "/wallpapers/1/like"):
  
  actionpack (5.0.4) lib/action_dispatch/middleware/debug_exceptions.rb:53:in `call'
  web-console (3.5.1) lib/web_console/middleware.rb:135:in `call_app'
  web-console (3.5.1) lib/web_console/middleware.rb:28:in `block in call'
  web-console (3.5.1) lib/web_console/middleware.rb:18:in `catch'
  web-console (3.5.1) lib/web_console/middleware.rb:18:in `call'
  actionpack (5.0.4) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
  railties (5.0.4) lib/rails/rack/logger.rb:36:in `call_app'
  railties (5.0.4) lib/rails/rack/logger.rb:24:in `block in call'
  activesupport (5.0.4) lib/active_support/tagged_logging.rb:69:in `block in tagged'
  activesupport (5.0.4) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (5.0.4) lib/active_support/tagged_logging.rb:69:in `tagged'
  railties (5.0.4) lib/rails/rack/logger.rb:24:in `call'
  sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call'
  actionpack (5.0.4) lib/action_dispatch/middleware/request_id.rb:24:in `call'
  rack (2.0.3) lib/rack/method_override.rb:22:in `call'
  rack (2.0.3) lib/rack/runtime.rb:22:in `call'
  activesupport (5.0.4) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
  actionpack (5.0.4) lib/action_dispatch/middleware/executor.rb:12:in `call'
  actionpack (5.0.4) lib/action_dispatch/middleware/static.rb:136:in `call'
  rack (2.0.3) lib/rack/sendfile.rb:111:in `call'
  railties (5.0.4) lib/rails/engine.rb:522:in `call'
  puma (3.9.1) lib/puma/configuration.rb:224:in `call'
  puma (3.9.1) lib/puma/server.rb:602:in `handle_request'
  puma (3.9.1) lib/puma/server.rb:435:in `process_client'
  puma (3.9.1) lib/puma/server.rb:299:in `block in run'
  puma (3.9.1) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
    Rendering C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.4/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within rescues/layout
    Rendering C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.4/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
    Rendered C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.4/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.5ms)
    Rendered collection of C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.4/lib/action_dispatch/middleware/templates/routes/_route.html.erb [11 times] (3.5ms)
    Rendered C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.4/lib/action_dispatch/middleware/templates/routes/_table.html.erb (5.0ms)
    Rendering C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.4/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
    Rendered C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.4/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.5ms)
    Rendered C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.4/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within rescues/layout (1391.8ms)
  </code></pre>
  
  <p><strong>my routes.rb file</strong></p>
  
  <pre><code>Rails.application.routes.draw do  
    root 'pages#home'
    get '/home', to: 'pages#home'
  
    resources :wallpapers do
      member do  
        post 'like'
      end
    end
  end
  </code></pre>
  
  <p><strong>my link_to</strong></p>
  
  <pre><code>&lt;%= link_to like_wallpaper_path(@wallpaper), :method =&gt; :post  do %&gt;
    &lt;i class="glyphicon glyphicon-thumbs-up"&gt;&lt;/i&gt;
  &lt;% end %&gt; 
  </code></pre>