0

This is similar to STI and form_for problem but the answer given there doesn't play nice with rails 3 and gives a deprecation warning. However, if I try and use the new syntax, I get a very confusing result. Here's the problem.

An event_enquiry is a kind of enquiry, and in the old syntax I would do

<%= form_for( :event_enquiry, @enquiry, :remote => true, :url=>{:id=>@enquiry.id,:action=>:build_provider_versions}

This generates the path expected /event_enquiries/1/build_provider_versions and in the log i see Started POST "/event_enquiries/1/build_provider_versions" for 127.0.0.1 at 2010-12-22 22:00:11 +0000

but this gives a deprecation warning

DEPRECATION WARNING: Using form_for(:name, @resource) is deprecated. Please use form_for(@resource, :as => :name) instead. 

BUT although the new syntax

<%= form_for(  @enquiry, :as => :event_enquiry,:remote => true, :url=>{:id=>@enquiry.id,:action=>:build_provider_versions}

appears to generate the same route, and in the log i get exactly the same message Started POST "/event_enquiries/1/build_provider_versions" for 127.0.0.1 at 2010-12-22 22:01:58 +0000 the route apparently does not exist!

ActionController::RoutingError (No route matches "/event_enquiries/1/build_provider_versions"):

I've been back and forth through this and cannot see what is going on. Does anyone have a clue what's happening?

Obviously I'm happy to drop back to the old syntax for now, but I have a nasty feeling something is broken here ... or am I just being stupid?

Community
  • 1
  • 1

1 Answers1

0

just add

 :html => {:method => :put}
Vlad
  • 442
  • 5
  • 15