From 0bb5726aa35019683456f6a60694303f79872b05 Mon Sep 17 00:00:00 2001 From: Vasiliy Ermolovich Date: Thu, 13 Sep 2012 23:07:31 +0300 Subject: [PATCH] raise ArgumentError when has_one association was provided --- lib/simple_form/form_builder.rb | 2 +- test/form_builder/association_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/simple_form/form_builder.rb b/lib/simple_form/form_builder.rb index 91abc1d2..6ed2b4ca 100644 --- a/lib/simple_form/form_builder.rb +++ b/lib/simple_form/form_builder.rb @@ -183,7 +183,7 @@ module SimpleForm when :belongs_to (reflection.respond_to?(:options) && reflection.options[:foreign_key]) || :"#{reflection.name}_id" when :has_one - raise ":has_one associations are not supported by f.association" + raise ArgumentError, ":has_one associations are not supported by f.association" else if options[:as] == :select html_options = options[:input_html] ||= {} diff --git a/test/form_builder/association_test.rb b/test/form_builder/association_test.rb index 95bbd300..3d11107a 100644 --- a/test/form_builder/association_test.rb +++ b/test/form_builder/association_test.rb @@ -120,7 +120,7 @@ class AssociationTest < ActionView::TestCase # ASSOCIATIONS - has_* test 'builder does not allow has_one associations' do - assert_raise RuntimeError do + assert_raise ArgumentError do with_association_for @user, :first_company, :as => :radio_buttons end end