From e5ddbef29cef7e95c01faa91c4f3aa754132e0c9 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Mon, 10 Mar 2014 16:25:54 -0500 Subject: [PATCH] Allow for multiple blueprints for the same association --- lib/nested_form/builder_mixin.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/nested_form/builder_mixin.rb b/lib/nested_form/builder_mixin.rb index 26a98877..02979a2c 100644 --- a/lib/nested_form/builder_mixin.rb +++ b/lib/nested_form/builder_mixin.rb @@ -31,7 +31,7 @@ def link_to_add(*args, &block) options[:class] = [options[:class], "add_nested_fields"].compact.join(" ") options["data-association"] = association - options["data-blueprint-id"] = fields_blueprint_id = fields_blueprint_id_for(association) + options["data-blueprint-id"] = fields_blueprint_id = fields_blueprint_id_for(options[:blueprint] || association) args << (options.delete(:href) || "javascript:void(0)") args << options @@ -83,7 +83,7 @@ def fields_for_with_nested_attributes(association_name, *args) end @fields ||= {} - @fields[fields_blueprint_id_for(association_name)] = { :block => block, :options => options } + @fields[fields_blueprint_id_for(options[:blueprint] || association_name)] = { :block => block, :options => options } super(association_name, *(args << block)) end