Sha256: bf3b5583aa143c2ba76707a408acf8a71d364214dae4b56244bf31b27af68f4a
Contents?: true
Size: 586 Bytes
Versions: 2
Compression:
Stored size: 586 Bytes
Contents
module JqueryDynamicFields module FieldHelper def link_to_add_fields name, f, association new_object = f.object.send(association).klass.new id = new_object.object_id fields = f.fields_for(association, new_object, child_index: id) do |builder| render(association.to_s.singularize + "_fields", f: builder) end link_to(name, '#', class: "add_fields", data: {id: id, fields: fields.gsub("\n", "")}) end def link_to_remove_field f (f.hidden_field :_destroy) + link_to("remove", "#", class: "remove_field") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jquery_dynamic_fields-0.0.5 | app/helpers/jquery_dynamic_fields/field_helper.rb |
jquery_dynamic_fields-0.0.4 | app/helpers/jquery_dynamic_fields/field_helper.rb |