rails coffeescript RESTful edit form submission not called

In the controller's coffeescript file I have

jQuery ->

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')

Need Your Help

How to see program variable name and values in heap dump?

java command-line dump jmap jhat

I am using JMAP to create a heap dump of JVM while executing a Java program. Then using JHAT I am opening the dump details in the browser.

Getting text from speech on Xamarin.iOS to start a method

android ios xamarin speech-recognition

I'm developing an application for Xamarin.Android and Xamarin.iOS and therefore I would need a possibility to start a recorder by just giving a command by speech.