arkaan 2.4.0 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/arkaan/files/document.rb +12 -2
- data/lib/arkaan/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fe7d3eac6402e98bbe2ad5d89304fa3724d3f4ae2cdf34b7d3e39cad91b933a
|
4
|
+
data.tar.gz: 9133895e88eee313f2c2e6dee1b328a37116d42dfd4f59d8a52631c8cb0206ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f8582bf8546ea97a51323c48a3e87e536e9c528c67739fa362150f69d56d4579d22e912f850206ab3dafe954365307cfaba70d812ee2702c04f90ae70de442f
|
7
|
+
data.tar.gz: 1700055797b5790f2fac0cbd40675f351490960ad4149c7f6a237c7774ae970515e165fed7f1e24ff86e82e71b5b2f1b884660aa6e9b93278d2e8dde5ed93c0f
|
@@ -30,11 +30,21 @@ module Arkaan
|
|
30
30
|
# @return [Array<Arkaan::Files::Permission>] the permissions granted to access this file.
|
31
31
|
has_many :permissions, class_name: 'Arkaan::Files::Permission', inverse_of: :file
|
32
32
|
|
33
|
-
validates :name, uniqueness: {message: 'uniq'}
|
34
|
-
|
35
33
|
validates :name, :extension, :folder, :mime_type, presence: {message: 'required'}
|
36
34
|
|
37
35
|
validates :folder, format: {without: /\/\//, message: 'format'}
|
36
|
+
|
37
|
+
validate :filename_unicity
|
38
|
+
|
39
|
+
def filename_unicity
|
40
|
+
existing = Arkaan::Files::Document.where(
|
41
|
+
name: name,
|
42
|
+
folder: folder,
|
43
|
+
extension: extension,
|
44
|
+
:id.ne => id
|
45
|
+
)
|
46
|
+
errors.add(:name, 'uniq') unless existing.first.nil?
|
47
|
+
end
|
38
48
|
end
|
39
49
|
end
|
40
50
|
end
|
data/lib/arkaan/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arkaan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Courtois
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|