Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

some problems with transfer options #720

Merged
merged 3 commits into from

2 participants

@achempion

simple_fields_for don't passed options and it's created some problems like this:
ryanb/nested_form#219
ryanb/nested_form#226

because if wrapper option is false, then wrapper not transfered

@achempion achempion some problems with transfer options
simple_fields_for don't passed options and it's created some problems like this:
ryanb/nested_form#219
ryanb/nested_form#226

because if wrapper option is false, then wrapper not transfered
c439ab3
@rafaelfranca

Could you add a test case?

achempion added some commits
@achempion achempion Update test/action_view_extensions/builder_test.rb
add new test, when we define wrapper: false oprion, wrapper must be crashed
be721c1
@achempion achempion Update test/action_view_extensions/builder_test.rb
update for syntax
9221f23
@rafaelfranca rafaelfranca merged commit 9221f23 into plataformatec:master
@rafaelfranca
Owner

Thank you

@achempion achempion deleted the unknown repository branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 29, 2012
  1. @achempion

    some problems with transfer options

    achempion authored
    simple_fields_for don't passed options and it's created some problems like this:
    ryanb/nested_form#219
    ryanb/nested_form#226
    
    because if wrapper option is false, then wrapper not transfered
  2. @achempion

    Update test/action_view_extensions/builder_test.rb

    achempion authored
    add new test, when we define wrapper: false oprion, wrapper must be crashed
  3. @achempion

    Update test/action_view_extensions/builder_test.rb

    achempion authored
    update for syntax
This page is out of date. Refresh to see the latest.
View
2  lib/simple_form/action_view_extensions/builder.rb
@@ -194,7 +194,7 @@ 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]
+ options[:wrapper] = self.options[:wrapper] if options[:wrapper].nil?
options[:defaults] ||= self.options[:defaults]
if self.class < ActionView::Helpers::FormBuilder
View
10 test/action_view_extensions/builder_test.rb
@@ -580,4 +580,14 @@ def with_collection_check_boxes(object, attribute, collection, value_method, tex
end
end
end
+
+ test 'fields don\'t 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, :wrapper => false) do |company|
+ assert_not_equal :another, company.options[:wrapper]
+ end
+ end
+ end
+ end
end
Something went wrong with that request. Please try again.