Permalink
Browse files

simple_fields_for inherites wrapper option from the parent form, closes

  • Loading branch information...
1 parent f804874 commit b683b21bf712dd5a2cbc6ea4b5c763b9746bec73 @nashby committed Nov 27, 2011
Showing with 12 additions and 0 deletions.
  1. +2 −0 lib/simple_form/action_view_extensions/builder.rb
  2. +10 −0 test/action_view_extensions/builder_test.rb
@@ -103,6 +103,8 @@ def collection_check_boxes(attribute, collection, value_method, text_method, opt
# end
def simple_fields_for(*args, &block)
options = args.extract_options!
+ options[:wrapper] ||= self.options[:wrapper]
+
if self.class < ActionView::Helpers::FormBuilder
options[:builder] ||= self.class
else
@@ -434,4 +434,14 @@ def with_collection_check_boxes(object, attribute, collection, value_method, tex
end
end
end
+
+ test 'fields inherites wrapper option from the parent form' do
+ swap_wrapper :another do
+ simple_form_for(:user, :wrapper => :another) do |f|
+ f.simple_fields_for(:company) do |company|
+ assert_equal :another, company.options[:wrapper]
+ end
+ end
+ end
+ end
end

0 comments on commit b683b21

Please sign in to comment.