mirror of
https://github.com/fspc/BikeShed-1.git
synced 2026-09-16 08:31:36 -04:00
git init
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
module ApplicationHelper
|
||||
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, '#', id: "add_#{association.to_s.singularize}" , class: "add_fields", data: {id: id, fields: fields.gsub("\n", "")})
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user