effective_resources 2.9.1 → 2.9.2

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: e271cc3c7cc6656818fa8584765872c44add6e05f45aebf71b21a2463d27975e
4
- data.tar.gz: b96b045469f418016cbef1d000eec3ee3b82b260122eff4a6f160e689f55f0b1
3
+ metadata.gz: 39969863270d4e8a60c93f0dd10f138a93936fa84958005d25ad1a6c2ab747dd
4
+ data.tar.gz: 3836b95d6616e55f9bcd9d0e1c859bf17e87ac0d78dcbd89a2cfd5fbb84fd32c
5
5
  SHA512:
6
- metadata.gz: b065909664f6d3dfd6cdb6589023dcd743b77feeccf2d98e74ef940780c5a48492681915437975aa7bd988251d768367d50b00f8198de841642af7728425eec7
7
- data.tar.gz: 44e79e8885d98c26b5179955f60cc7b775efac0d7804712e4d5556b20df09fc00d6efad0f9db8e40a0e61c959fc355ec5cf7b7314dcec80aceb0f476932fd9a3
6
+ metadata.gz: 7c5b1e1c914d649b9c56004066d21d2d3125a68246dc15c95934850f3e2ae68c4d6eb07e1d55c6d163c2de42bdab06340d26dbd3561273078496aa3a41b80e84
7
+ data.tar.gz: c7e7eb23d4363b1977147d7e26ff2481dadf83ecd7326616f95392df404fff13d9434ac40f8091e41d6d07199b0f9d62f1c6a21bba3252366f5484a90adb32e7
@@ -15,9 +15,15 @@ class SizeValidator < ActiveModel::EachValidator
15
15
  max_size = options.try(:[], :less_than) || 2.megabytes
16
16
  message = options.try(:[], :message) || "is too large, please upload a file smaller than #{max_size / 1.megabyte}MB"
17
17
 
18
- if value.blob.byte_size > max_size
19
- record.errors.add(attribute, message)
18
+ blobs = value.try(:blobs) || value.try(:blob) || raise('unable to find blobs')
19
+
20
+ Array(blobs).each do |blob|
21
+ if blob.byte_size > max_size
22
+ record.errors.add(attribute, message)
23
+ break
24
+ end
20
25
  end
21
26
 
27
+ true
22
28
  end
23
29
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '2.9.1'.freeze
2
+ VERSION = '2.9.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.1
4
+ version: 2.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect