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

No activity found to handle custom intent

java android xml eclipse android-intent

Using a customer defined activity and i've declared the intent action in the manifest.xml

Hadoop 2.4.1 and Google Cloud Storage connector for Hadoop

hadoop google-compute-engine google-hadoop oryx

I am trying to run Oryx on top of Hadoop using Google's Cloud Storage Connector for Hadoop:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.