superstore 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd5cf2fdffdd1441b0a0663f90ef27127795a75e
|
4
|
+
data.tar.gz: da3161e0e1f07c0fd2cb2f0f8378bc2c3e3fa679
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9eca1be4674e7b6ed593986499bf5daaed8f574794a6488de55a9b7c141c7da3ef50a5ca3d7dad0e6a29717e9b4c93cd0337c437409b44cffa98987c8c9533fc
|
7
|
+
data.tar.gz: 6eac3d6075b98f8658030c6d1d3aceeeb1e0b3e308ce88af92a9c20580a7d062d388fd849afff147cd134c64da9fb5bd70dd9048213a8f012c7f81f66225dcfb
|
@@ -21,6 +21,12 @@ module Superstore
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
def unapplied_changes
|
25
|
+
result = {}
|
26
|
+
changed_attributes.each_key { |attr| result[attr] = read_attribute(attr) }
|
27
|
+
result
|
28
|
+
end
|
29
|
+
|
24
30
|
def write_attribute(name, value)
|
25
31
|
name = name.to_s
|
26
32
|
old = read_attribute(name)
|
@@ -146,8 +146,7 @@ module Superstore
|
|
146
146
|
end
|
147
147
|
|
148
148
|
def write(method)
|
149
|
-
|
150
|
-
self.class.send(method, id, changed_attributes)
|
149
|
+
self.class.send(method, id, unapplied_changes)
|
151
150
|
end
|
152
151
|
end
|
153
152
|
end
|
data/superstore.gemspec
CHANGED
@@ -51,6 +51,17 @@ class Superstore::AttributeMethods::DirtyTest < Superstore::TestCase
|
|
51
51
|
assert record.changed?
|
52
52
|
end
|
53
53
|
|
54
|
+
test 'unapplied_changes' do
|
55
|
+
record = temp_object do
|
56
|
+
float :price
|
57
|
+
string :color
|
58
|
+
end.create(price: 5.01, color: 'green')
|
59
|
+
|
60
|
+
record.color = 'blue'
|
61
|
+
|
62
|
+
assert_equal({'color' => 'blue'}, record.unapplied_changes)
|
63
|
+
end
|
64
|
+
|
54
65
|
test 'write_attribute' do
|
55
66
|
object = temp_object do
|
56
67
|
string :name
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: superstore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Koziarski
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-06-
|
12
|
+
date: 2014-06-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|