Skip to content

Commit

Permalink
Merge branch 'patch-1' of git://github.com/grk/nested_form into rails31
Browse files Browse the repository at this point in the history
  • Loading branch information
fxposter committed Jun 13, 2011
2 parents 17d5bd1 + 30d365b commit 6a1600e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/nested_form/builder_mixin.rb
Expand Up @@ -48,12 +48,16 @@ def link_to_remove(*args, &block)
hidden_field(:_destroy) + @template.link_to(*args, &block)
end

def fields_for_with_nested_attributes(association_name, args, block)
def fields_for_with_nested_attributes(association_name, *args, block)
# TODO Test this better
block ||= Proc.new { |fields| @template.render(:partial => "#{association_name.to_s.singularize}_fields", :locals => {:f => fields}) }
@fields ||= {}
@fields[association_name] = block
super(association_name, args, block)
if Rails::VERSION::MAJOR >= 3 && Rails::VERSION::MINOR >= 1
super(association_name, args.first, args.last, block)
else
super(association_name, *args, block)
end
end

def fields_for_nested_model(name, object, options, block)
Expand Down

0 comments on commit 6a1600e

Please sign in to comment.