1
0
Fork 0
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:
Lucas Mazza 2012-10-07 22:09:57 -03:00
parent b5f2ea420d
commit a92d846f62
2 changed files with 12 additions and 1 deletions

View file

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

View file

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