Created
August 2, 2011 12:47
-
-
Save tallgreentree/1120110 to your computer and use it in GitHub Desktop.
Add Object Link helper function - great for nested form fields.
This file contains 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
module NestedFormHelper | |
def add_object_link(name, form, object, partial, where) | |
html = render(:partial => partial, :locals => { :form => form}, :object => object) | |
link_to_function name, %{ | |
var new_object_id = new Date().getTime() ; | |
var html = jQuery('#{where}').append('#{html.gsub(/\n/, ' ')}'); | |
} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment