lib/formtastic.rb in nofxx-formtastic-0.1.7 vs lib/formtastic.rb in nofxx-formtastic-0.1.8
- old
+ new
@@ -353,12 +353,12 @@
form = render_associated_form(object, :partial => partial)
form.gsub!(/attributes_(\d+)/, '__idx__')
form.gsub!(/\[(\d+)\]/, '__idxx__')
function = "if (typeof #{variable} == 'undefined') #{variable} = #{$1};
- $(#{container}).append($.template(#{form.to_json}.replace(/__idx__/g, \"attributes_\" +
- #{variable}).replace(/__idxx__/g, \"[\" + #{variable}++ + \"]\")))"
+ $(#{container}).append(#{form.to_json}.replace(/__idx__/g, 'attributes_' +
+ #{variable}).replace(/__idxx__/g, '[' + #{variable}++ + ']'))"
template.link_to_function(name, function, opts)
end
# Render associated form
@@ -373,10 +373,10 @@
partial = opts[:partial] || name
local_assign_name = partial.split('/').last.split('.').first
output = associated.map do |element|
fields_for(association_name(name), element, (opts[:fields_for] || {}).merge(:name => name)) do |f|
- render({:partial => "#{partial}", :locals => {local_assign_name.to_sym => element, :f => f}.merge(opts[:locals] || {})}.merge(opts[:render] || {}))
+ template.render({:partial => "#{partial}", :locals => {local_assign_name.to_sym => element, :f => f}.merge(opts[:locals] || {})}.merge(opts[:render] || {}))
end
end
output.join
end
end