objectstore 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/atech/object_store.rb +1 -1
- data/lib/atech/object_store/file.rb +8 -2
- 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: 3236943c5074458941ff9c00a1aba785c347d641
|
4
|
+
data.tar.gz: ebb78024e581576a84bde92add4a39a12d17b667
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fab4ae85a925ae2f04607844934f852dce4e5c98444a9eccb21c5bf933302ab38a1f7c161dd31e3040f0c6bb6080841e266fc7d1ca0bafeecfaa83d7467d705f
|
7
|
+
data.tar.gz: 133179d6e5dd12f5703fe7e55c067dcd4748636408a2afed263fe9d7d796c698fa0c99a226b41c552c9b1006b4210428a1d880f6e20df4eb9146a55953959eac
|
data/lib/atech/object_store.rb
CHANGED
@@ -26,8 +26,14 @@ module Atech
|
|
26
26
|
## Returns a new file object for the given ID. If no file is found a FileNotFound exception will be raised
|
27
27
|
## otherwise the File object will be returned.
|
28
28
|
def self.find_by_id(id)
|
29
|
-
result = File.execute_query("SELECT * FROM files WHERE id = #{id.to_i}")
|
30
|
-
|
29
|
+
result = File.execute_query("SELECT * FROM files WHERE id = #{id.to_i}")
|
30
|
+
result = result.first if result
|
31
|
+
|
32
|
+
if result
|
33
|
+
self.new(result)
|
34
|
+
else
|
35
|
+
raise(FileNotFound, "File not found with id '#{id.to_i}'")
|
36
|
+
end
|
31
37
|
end
|
32
38
|
|
33
39
|
## Imports a new file by passing a path and returning a new File object once it has been added to the database.
|