Skip to content

Instantly share code, notes, and snippets.

@tallgreentree
Created August 2, 2011 12:47
Show Gist options
  • Save tallgreentree/1120110 to your computer and use it in GitHub Desktop.
Save tallgreentree/1120110 to your computer and use it in GitHub Desktop.
Add Object Link helper function - great for nested form fields.
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