nested_form_fields 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -19,10 +19,6 @@ Add this line to your application's Gemfile:
19
19
  And then execute:
20
20
 
21
21
  $ bundle
22
-
23
- Or install it yourself as:
24
-
25
- $ gem install nested_form_fields
26
22
 
27
23
  In your application.js file add:
28
24
 
@@ -41,27 +41,21 @@ module ActionView::Helpers
41
41
  association = convert_to_model(association)
42
42
 
43
43
  if association.respond_to?(:persisted?)
44
- association = [association] if @object.send(association_name).is_a?(Array)
44
+ association = [association]
45
45
  elsif !association.respond_to?(:to_ary)
46
46
  association = @object.send(association_name)
47
47
  end
48
48
 
49
- if association.respond_to?(:to_ary)
50
- explicit_child_index = options[:child_index]
51
- output = ActiveSupport::SafeBuffer.new
52
- association.each do |child|
53
- output << nested_fields_wrapper(association_name) do
54
- fields_for_nested_model("#{name}[#{explicit_child_index || nested_child_index(name)}]", child, options, block)
55
- end
49
+ explicit_child_index = options[:child_index]
50
+ output = ActiveSupport::SafeBuffer.new
51
+ association.each do |child|
52
+ output << nested_fields_wrapper(association_name) do
53
+ fields_for_nested_model("#{name}[#{explicit_child_index || nested_child_index(name)}]", child, options, block)
56
54
  end
57
-
58
- templates = nested_model_template(name, association_name, options, block)
59
- output << templates
60
-
61
- output
62
- elsif association
63
- fields_for_nested_model(name, association, options, block)
64
55
  end
56
+
57
+ output << nested_model_template(name, association_name, options, block)
58
+ output
65
59
  end
66
60
 
67
61
 
@@ -1,3 +1,3 @@
1
1
  module NestedFormFields
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nested_form_fields
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-21 00:00:00.000000000Z
12
+ date: 2012-05-22 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: ! "Rails gem for dynamically adding and removing nested has_many association
15
15
  fields in a form.\n Uses jQuery and supports multiple nesting