mirror of
https://github.com/heartcombo/simple_form.git
synced 2022-11-09 12:19:26 -05:00
Use lookup_model_names
instead object_name
.
b5f2ea420d (commitcomment-1959017)
This commit is contained in:
parent
b5f2ea420d
commit
a92d846f62
2 changed files with 12 additions and 1 deletions
|
@ -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 a new issue