aform 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b760e75954d9b87f0d231366049f97cc1fb0efdc
4
- data.tar.gz: aa6ff6435aa01dd39298feba9079d8265c4fe029
3
+ metadata.gz: fe5b2d60a9140c2a2477d80b1c6eb8a9a1d7efe7
4
+ data.tar.gz: 64377b994360f01535d6d94e9933dd026cb6bda9
5
5
  SHA512:
6
- metadata.gz: fbcf7b499c554d78456c58a5f0a941f9118b00320ffe8bc92df407ca1d74876484c647336579fb334684ca7662333be89a656870935e4a1222e3026e1107bf7a
7
- data.tar.gz: 5ac45ca4a8dcfd4c66efc27dea3c336741dd9058c4641ae334cb0ff6d8e3c1fe707769838538d83098c9bc9d9e7cec15a45db2e6f34602db75fd3fb5d8daffcd
6
+ metadata.gz: 7aca61c011ecbfa66e5b810fa514e3a09ef786b57f0a93fbe97ee156ac86bc25832997f37d556693f11b7c2bddaa4bb8e8e98960dac5128d34c838dc70d7c196
7
+ data.tar.gz: 4dd679c64d3cda49eab1ca903d8071bf3eaf06fab3b9923c399ad62c69c3751807e62bbcd4d72b9f30f2aa2033e906ff1346b625ca00db86e668dc01bc23e6bc
data/lib/aform/form.rb CHANGED
@@ -81,7 +81,7 @@ module Aform
81
81
  def initialize_nested
82
82
  if nested_form_klasses
83
83
  nested_form_klasses.each do |k,v|
84
- if attributes.has_key? k
84
+ if attributes.has_key?(k) && attributes[k]
85
85
  attributes[k].each do |attrs|
86
86
  @nested_forms ||= {}
87
87
  @nested_forms[k] ||= []
data/lib/aform/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Aform
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -116,6 +116,16 @@ describe "saving" do
116
116
  Comment.count.must_equal 1
117
117
  Like.count.must_equal 1
118
118
  end
119
+
120
+ context "when nested is nil" do
121
+ it "saves without nested" do
122
+ post = Post.new
123
+ attrs = {title: "Cool Post", author: "John Doe",
124
+ comments: nil}
125
+ form = PostForm.new(post, attrs)
126
+ form.save.must_equal true
127
+ end
128
+ end
119
129
  end
120
130
 
121
131
  context "attributes from method" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Versal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-12 00:00:00.000000000 Z
11
+ date: 2014-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport