简体   繁体   中英

Link_to post method is converted to get

After some time off Rails, i am creating a 3.1 rails project now. I pasted some code from a previous project to create a link_to that posts a value, but i can't get to have the correct behaviour for some reason, and i don't see why. The link_to is (building_controller):

<%= link_to "Upgrade", upgrade_building_path(:id => construction.building.id), :method => :post %>

ROUTE :

  scope :path => '/building', :controller => :building do
    post 'upgrade' => :upgrade, :as => 'upgrade_building'
  end  

This actually gives me a :

No route matches [GET] "/building/upgrade"

Any ideas why ?

Following Prair's comment above, the solution was :

<%= javascript_include_tag :application %>

new technologies in rails every 3 months i guess, sprockets this time :P

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM