rails coffeescript RESTful edit form submission not called
In the controller's coffeescript file I have
jQuery -> billing_account.setupForm() billing_account = setupForm: -> $('#new_billing_account').submit ->
And, the $('#new_billing_account').submit function is called when a new resource is created. However, when I edit a resource $('#new_billing_account').submit is not longer called when the form is submitted; however, the form is indeed submitted.
I tried adding different form name prefixes but neither $('#update_billing_account').submit nor $('#edit_billing_account').submit are called.
How do I get edit/update to call the same (or any) form setup code?
I'm using a default RESTful generated resource scaffold with Rails 3.2.
You'd have to change new_billing_account to whatever the id of the form is (look at the generated html). By default rails sets the id on an edit form to edit_model_name_id, for example when editing theBillingAccountwith id 456, the form would have idedit_billing_account_456`.
You can pass extra options to form for to force the id to something constant, or you can use the fact that the form's class will be set to edit_brand (i.e. change your selector to $('form.edit_billing_account')