_updateFields js should start with first list item position of 1, not 0 #1

Open
aepstein wants to merge 16 commits from aepstein/patch-1 into master
Showing only changes of commit 83beb92d4a - Show all commits

View File

@ -21,7 +21,7 @@ class CocoonInput
def semantic_fields_for def semantic_fields_for
builder.semantic_fields_for(method) do |fields| builder.semantic_fields_for(method) do |fields|
if fields.object if fields.object
template.render :partial => "#{method.to_s.singularize}_fields", :locals => { :f => fields } template.render :partial => "#{singular_method}_fields", :locals => { :f => fields }
end end
end end
end end
@ -32,7 +32,7 @@ class CocoonInput
def links def links
template.content_tag(:div, :class => 'links') do template.content_tag(:div, :class => 'links') do
template.link_to_add_association template.t('.add'), builder, method, input_html_options template.link_to_add_association template.t(".add_#{singular_method}"), builder, method, input_html_options
end end
end end
@ -43,5 +43,10 @@ class CocoonInput
'data-association-insertion-method' => 'append' 'data-association-insertion-method' => 'append'
) )
end end
private
def singular_method
@singular_method ||= method.to_s.singularize
end
end end