Created
April 13, 2011 03:18
-
-
Save developish/916902 to your computer and use it in GitHub Desktop.
For adding nested form objects with Rails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Works in conjunction with the generate_template helper to insert new | |
// objects into a form that has a collection of items. | |
$.fn.appendFromTemplate = function(template) { | |
return this.each(function () { | |
var newId = new Date().getTime(); | |
$(this).append(template.replace(/NEW_RECORD/g, newId)); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment