Permalink
Browse files

Merge pull request #432 from mjtko/fix/jquery-ready-call

Prevent ReferenceError when rails.validations evaluated after DOM ready
  • Loading branch information...
bcardarella committed Nov 9, 2012
2 parents 94375eb + 049ce24 commit 6ab147d327e1dbd3f31d77e3ec40f531dbbf952d
Showing with 9 additions and 9 deletions.
  1. +5 −5 coffeescript/rails.validations.coffee
  2. +4 −4 vendor/assets/javascripts/rails.validations.js
@@ -95,11 +95,6 @@ validateElement = (element, validators) ->
afterValidate()
-# Main hook
-# If new forms are dynamically introduced into the DOM the .validate() method
-# must be invoked on that form
-$(-> $(ClientSideValidations.selectors.forms).validate())
-
if window.ClientSideValidations == undefined
window.ClientSideValidations = {}
@@ -441,3 +436,8 @@ window.ClientSideValidations.callbacks =
before: (form, eventData) ->
fail: (form, eventData) ->
pass: (form, eventData) ->
+
+# Main hook
+# If new forms are dynamically introduced into the DOM the .validate() method
+# must be invoked on that form
+$(-> $(ClientSideValidations.selectors.forms).validate())

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 6ab147d

Please sign in to comment.