1

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 ?

Spyros
  • 46,820
  • 25
  • 86
  • 129
  • Are you load the rails ujs javascript (Either via the prototype-ujs or jquery-ujs libraries, depending on whether you are using prototype or jquery) – Frederick Cheung Jan 16 '12 at 10:13
  • just jquery-min and ui from what i can see now. (unless it's automatically added somehow) – Spyros Jan 16 '12 at 10:26
  • Hope this helps :) => http://stackoverflow.com/questions/5315465/rails-3-link-to-generator-for-post-put-delete – Prair Jan 16 '12 at 10:49

1 Answers1

1

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

Spyros
  • 46,820
  • 25
  • 86
  • 129