Skip to content
This repository
Browse code

raise ArgumentError when has_one association was provided

  • Loading branch information...
commit 0bb5726aa35019683456f6a60694303f79872b05 1 parent 7710c3b
Vasiliy Ermolovich nashby authored
2  lib/simple_form/form_builder.rb
@@ -183,7 +183,7 @@ def association(association, options={}, &block)
183 183 when :belongs_to
184 184 (reflection.respond_to?(:options) && reflection.options[:foreign_key]) || :"#{reflection.name}_id"
185 185 when :has_one
186   - raise ":has_one associations are not supported by f.association"
  186 + raise ArgumentError, ":has_one associations are not supported by f.association"
187 187 else
188 188 if options[:as] == :select
189 189 html_options = options[:input_html] ||= {}
2  test/form_builder/association_test.rb
@@ -120,7 +120,7 @@ def with_association_for(object, *args)
120 120
121 121 # ASSOCIATIONS - has_*
122 122 test 'builder does not allow has_one associations' do
123   - assert_raise RuntimeError do
  123 + assert_raise ArgumentError do
124 124 with_association_for @user, :first_company, :as => :radio_buttons
125 125 end
126 126 end

0 comments on commit 0bb5726

Please sign in to comment.
Something went wrong with that request. Please try again.