Use `lookup_model_names` instead `object_name`.
b5f2ea420d (commitcomment-1959017)
This commit is contained in:
parent
b5f2ea420d
commit
a92d846f62
|
@ -83,7 +83,7 @@ module SimpleForm
|
|||
end
|
||||
|
||||
def input_class
|
||||
"#{object_name}_#{reflection_or_attribute_name}"
|
||||
"#{lookup_model_names.join("_")}_#{reflection_or_attribute_name}"
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -16,6 +16,17 @@ class WrapperTest < ActionView::TestCase
|
|||
assert_select 'div.user_name'
|
||||
end
|
||||
|
||||
test 'wrapper should add the attribute name class for nested forms' do
|
||||
@user.company = Company.new(1, 'Empresa')
|
||||
with_concat_form_for @user do |f|
|
||||
concat(f.simple_fields_for(:company) do |company_form|
|
||||
concat(company_form.input :name)
|
||||
end)
|
||||
end
|
||||
|
||||
assert_select 'div.user_company_name'
|
||||
end
|
||||
|
||||
test 'wrapper should add the association name class' do
|
||||
with_form_for @user, :company
|
||||
assert_select 'div.user_company'
|
||||
|
|
Loading…
Reference in New Issue