mm_no_empties 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.
@@ -1,3 +1,3 @@
1
1
  module MmNoEmpties
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/mm_no_empties.rb CHANGED
@@ -38,7 +38,7 @@ module MmNoEmpties
38
38
  if include_all
39
39
  attrs[association.name] = val
40
40
  else
41
- attrs[association.name] = val unless val.empty?
41
+ attrs[association.name] = val unless val.nil? or (val.is_a?(Array) and val.empty?)
42
42
  end
43
43
 
44
44
  end
@@ -13,6 +13,7 @@ describe MmNoEmpties do
13
13
  plugin MmNoEmpties
14
14
 
15
15
  many :people, :class_name => 'Person'
16
+ one :owner, :class_name => 'Person'
16
17
  belongs_to :company
17
18
 
18
19
  key :motto, String
@@ -48,7 +49,7 @@ describe MmNoEmpties do
48
49
  end
49
50
 
50
51
  it "should not include unused many associations in attributes" do
51
- @group.attributes.keys.should_not include('people', 'company_id')
52
+ @group.attributes.keys.should_not include('people', 'owner', 'company_id')
52
53
  end
53
54
 
54
55
  it "should restore empty fields when loading from the database" do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jonathan Chambers
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-12-23 00:00:00 +00:00
17
+ date: 2012-01-01 00:00:00 +00:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency