diff --git a/lib/simple_form/form_builder.rb b/lib/simple_form/form_builder.rb index 3eb9f873..dfbac7d6 100644 --- a/lib/simple_form/form_builder.rb +++ b/lib/simple_form/form_builder.rb @@ -173,7 +173,7 @@ module SimpleForm attribute = case reflection.macro when :belongs_to - reflection.options[:foreign_key] || :"#{reflection.name}_id" + (reflection.respond_to?(:options) && reflection.options[:foreign_key]) || :"#{reflection.name}_id" when :has_one raise ":has_one associations are not supported by f.association" else