custom-attributes 0.2.15 → 0.2.16

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.15
1
+ 0.2.16
@@ -13,7 +13,8 @@ class ActiveRecord::CustomAttributes::CustomAttributeList
13
13
  attribute_type = attribute_type.to_sym
14
14
  if supported_attribute_types.keys.include? attribute_type
15
15
  values.each do |key, attributes|
16
- add attribute_type, attributes["label"], attributes["value"] unless key == "%nr%"
16
+ removed = attributes["_destroy"]
17
+ add attribute_type, attributes["label"], attributes["value"] unless key == "%nr%" or removed
17
18
  end
18
19
  end
19
20
  end
@@ -127,6 +127,31 @@ describe "Custom attributes of a person" do
127
127
  fields[1].value.should == "1234567890"
128
128
 
129
129
 
130
+ custom_attribute_second_post_data = {
131
+ "telephone" => {
132
+ "0" => {
133
+ "label" => "Prive",
134
+ "value" => "06 28 61 06 28",
135
+ "_destroy" => true
136
+ },
137
+ "1" => {
138
+ "label" => "Werk",
139
+ "value" => "1234567890"
140
+ }
141
+ },
142
+ "email" => {
143
+ "0" => {
144
+ "label" => "Prive",
145
+ "value" => "matthijs.groen@gmail.com"
146
+ }
147
+ }
148
+ }
149
+ @person.custom_attributes = custom_attribute_second_post_data
150
+
151
+ fields = @person.custom_attributes.telephone_attributes
152
+ fields.should have(1).items
153
+ fields[0].value.should == "1234567890"
154
+
130
155
  end
131
156
 
132
157
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: custom-attributes
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 55
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 15
10
- version: 0.2.15
9
+ - 16
10
+ version: 0.2.16
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matthijs Groen
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-13 00:00:00 +02:00
18
+ date: 2010-10-20 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21