From 7bcd2aa98d9b36285b5a17a9868fa52aee6c43f0 Mon Sep 17 00:00:00 2001 From: nathanvda Date: Fri, 16 Mar 2012 20:08:19 +0100 Subject: [PATCH] Make sure cocoon still works on rails 3.0 (where conditions is not yet supported). Fixes #47. --- lib/cocoon/view_helpers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cocoon/view_helpers.rb b/lib/cocoon/view_helpers.rb index 1d30e31..8072a8a 100644 --- a/lib/cocoon/view_helpers.rb +++ b/lib/cocoon/view_helpers.rb @@ -81,7 +81,7 @@ module Cocoon def create_object(f, association) assoc = f.object.class.reflect_on_association(association) - conditions = assoc.conditions.flatten + conditions = assoc.respond_to?(:conditions) ? assoc.conditions.flatten : [] new_object = assoc.klass.new(*conditions) end