For the sake of argument, we have "new product" form.
I use some javascript libraries for html form elements (e.g. icheck, select2, wysihtml5). These form elements needed to be run with their associated js library functions to show properly (e.g. $(".checkbox").iCheck({...}) ) before rendering the HTML page.
If there is validation errors on submitting the form, Rails will render action "new" to reshow "new product" form with errors (exactly in the "Create" method in "ProductsController").
The problem is Rails will not execute associated javascript files (e.g. products.js.coffee) again in this situation. Then, the javascript based html form elements cannot be shown properly as they should be (because $(".checkbox").iCheck({...}) does not get executed).
How can I resolve this problem?