raise ArgumentError when has_one association was provided

This commit is contained in:
Vasiliy Ermolovich 2012-09-13 23:07:31 +03:00
parent 7710c3b0e9
commit 0bb5726aa3
2 changed files with 2 additions and 2 deletions

View File

@ -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] ||= {}

View File

@ -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