store-active_record 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/store/active_record/version.rb +1 -1
- data/lib/store/active_record.rb +9 -3
- 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: 06f93e0e4c6c46c21586b804439ccd7db50bc07f
|
4
|
+
data.tar.gz: 8151033e2c0b28631ecaf3c6e1869e17ec534f2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d309d61d61127edef84588d6b1849516a4d6c9e58caa35f4bda860552c80d05ee35e39202b858cb22bbfed684e8d2b93d24fc34cf607abee7fbc32cb654d63f7
|
7
|
+
data.tar.gz: 58aba3803a6cdd80a398d376d6882928064ec1f86ae45ad5975c87e6abadc7ff79962f51669b30a924611e294a29eb6551fa9e6e3a02e2bedba28d017ca2501b
|
data/lib/store/active_record.rb
CHANGED
@@ -17,17 +17,23 @@ class Store
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def update(id, data)
|
20
|
-
find_by_id(id)
|
20
|
+
if found = find_by_id(id)
|
21
|
+
found.update_attributes(data)
|
22
|
+
end
|
21
23
|
id
|
22
24
|
end
|
23
25
|
|
24
26
|
def delete(id)
|
25
|
-
find_by_id(id)
|
27
|
+
if found = find_by_id(id)
|
28
|
+
found.delete
|
29
|
+
end
|
26
30
|
id
|
27
31
|
end
|
28
32
|
|
29
33
|
def single_find(id)
|
30
|
-
find_by_id(id)
|
34
|
+
if found = find_by_id(id)
|
35
|
+
found.to_hash
|
36
|
+
end
|
31
37
|
rescue ::ActiveRecord::RecordNotFound
|
32
38
|
nil
|
33
39
|
end
|