superstore 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/superstore/persistence.rb +5 -11
- data/superstore.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c19b1ea6b25bd38b5dd4a2a64c8b12002015b750
|
4
|
+
data.tar.gz: b6ae687fdf28f34c3f0ec5577d8c0abce2044cfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6bdbbfde5df3bad14ea2cf542fb3eda7f888fecb6c9ae516055164300e3f74ca62b466c837286baaf5a270a1f32ccdbc310a1d4e456bf5cf9b00c4a1a2ff7c5
|
7
|
+
data.tar.gz: 8bb6ba4bddcd5cf5887397223da51e52b9c607e754ec365ef1219a0857e9b8c408ee4c43b89b00abcad184ddafe3272e8c49e4b24215cddff9c1e71aac28381a
|
@@ -65,27 +65,21 @@ module Superstore
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def typecast_persisted_attributes(attributes)
|
68
|
-
|
69
|
-
end
|
70
|
-
|
71
|
-
def typecast_persisted_attributes!(attributes)
|
72
|
-
attributes = attributes.dup
|
68
|
+
result = {}
|
73
69
|
|
74
70
|
attributes.each do |key, value|
|
75
71
|
if definition = attribute_definitions[key]
|
76
|
-
|
77
|
-
elsif key != primary_key
|
78
|
-
attributes.delete(key)
|
72
|
+
result[key] = definition.instantiate(value)
|
79
73
|
end
|
80
74
|
end
|
81
75
|
|
82
76
|
attribute_definitions.each_value do |definition|
|
83
|
-
unless definition.default.nil? ||
|
84
|
-
|
77
|
+
unless definition.default.nil? || result.has_key?(definition.name)
|
78
|
+
result[definition.name] = definition.default
|
85
79
|
end
|
86
80
|
end
|
87
81
|
|
88
|
-
|
82
|
+
result
|
89
83
|
end
|
90
84
|
end
|
91
85
|
|
data/superstore.gemspec
CHANGED