Skip to content

Commit 6a1600e

Browse files
committed
Merge branch 'patch-1' of git://github.com/grk/nested_form into rails31
2 parents 17d5bd1 + 30d365b commit 6a1600e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: lib/nested_form/builder_mixin.rb

+6-2
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,16 @@ def link_to_remove(*args, &block)
4848
hidden_field(:_destroy) + @template.link_to(*args, &block)
4949
end
5050

51-
def fields_for_with_nested_attributes(association_name, args, block)
51+
def fields_for_with_nested_attributes(association_name, *args, block)
5252
# TODO Test this better
5353
block ||= Proc.new { |fields| @template.render(:partial => "#{association_name.to_s.singularize}_fields", :locals => {:f => fields}) }
5454
@fields ||= {}
5555
@fields[association_name] = block
56-
super(association_name, args, block)
56+
if Rails::VERSION::MAJOR >= 3 && Rails::VERSION::MINOR >= 1
57+
super(association_name, args.first, args.last, block)
58+
else
59+
super(association_name, *args, block)
60+
end
5761
end
5862

5963
def fields_for_nested_model(name, object, options, block)

0 commit comments

Comments
 (0)