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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88f3666897172e59135de5920b17f9356a7cdcf2877b5f5244eb21b55f95c7c8
4
- data.tar.gz: 73c232117a9f905d00d1853d03176460b139a8a8b9b59544a5975d6af825d5c1
3
+ metadata.gz: 6fe7d3eac6402e98bbe2ad5d89304fa3724d3f4ae2cdf34b7d3e39cad91b933a
4
+ data.tar.gz: 9133895e88eee313f2c2e6dee1b328a37116d42dfd4f59d8a52631c8cb0206ec
5
5
  SHA512:
6
- metadata.gz: 3035f83abcc6a2970d3fa21b149fe70ab6f9e7908fa124c01917a54c89d087a1239694e82241882df74b672494b3e38d1a9951b83bca512b54ee10134f7e4c6b
7
- data.tar.gz: c5529c6c1c9ba7686492379bff4e2ab509d0a0f9515d1c77b190a175000af86ba8bedd22b2a919fa7c6a375253d8c9036fa41d5ab33d14c55a4eaec2a29d55e7
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
@@ -1,3 +1,3 @@
1
1
  module Arkaan
2
- VERSION = '2.4.0'
2
+ VERSION = '2.4.1'
3
3
  end
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.0
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-06 00:00:00.000000000 Z
11
+ date: 2020-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec