Permalink
Browse files

Use `lookup_model_names` instead `object_name`.

  • Loading branch information...
1 parent b5f2ea4 commit a92d846f62a76d6fd95a1d8b3991d3480f3c8edf @lucasmazza lucasmazza committed Oct 8, 2012
Showing with 12 additions and 1 deletion.
  1. +1 −1 lib/simple_form/inputs/base.rb
  2. +11 −0 test/form_builder/wrapper_test.rb
@@ -83,7 +83,7 @@ def additional_classes
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'

0 comments on commit a92d846

Please sign in to comment.