Sha256: f758625a81f9cd13ba05fcba9e4c60e4002354571b446dfb07263c35913e7a51
Contents?: true
Size: 1.31 KB
Versions: 7
Compression:
Stored size: 1.31 KB
Contents
module RailsApiDoc module ApisHelper def link_to_add_fields(name, f, association) new_object = f.object.class.reflect_on_association(association).klass.new fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| render(association.to_s.singularize + "_fields", :f => builder) end link_to_function(name, ("add_fields(this, '#{association}', '#{escape_javascript(fields)}')")) end def link_to_add_success_fields(name, f, association) new_object = f.object.class.reflect_on_association(association).klass.new fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| render(association.to_s.singularize + "_fields", :f => builder) end link_to_function(name, ("add_success_fields(this, '#{association}', '#{escape_javascript(fields)}')")) end def link_to_add_failure_fields(name, f, association) new_object = f.object.class.reflect_on_association(association).klass.new fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| render(association.to_s.singularize + "_fields", :f => builder) end link_to_function(name, ("add_failure_fields(this, '#{association}', '#{escape_javascript(fields)}')")) end end end
Version data entries
7 entries across 7 versions & 1 rubygems