active_storage_validations 0.8.3 → 0.8.4

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: 59e2305595247b963cfc53eac55689de8e915007da3d609312097225c1d445aa
4
- data.tar.gz: d625a4d73f7521c7ca59cf47e346f2d7e0958a9553d8bbb44415de393eff0d90
3
+ metadata.gz: e849b34d9f400b0fcd81c54a90cb8da3c9ba6dd6ac20299d4269779462af037d
4
+ data.tar.gz: 69f0898b82531b842556e266fcd8c196194499754c3b99b699577f81f0e3ee0f
5
5
  SHA512:
6
- metadata.gz: 32e42e928386309a0133372816cfde4e6df25c27d23c0193a14427d2d0e98122e74edcd62a1dbc9ed68470bc5f831ece9dedcdfd285370eac52d952dbe516b8e
7
- data.tar.gz: 917a1594f7a1a24e4a8f13c6546351a6e52d54cc015e5a7e65422573e0a0784250f00572f15442030be73e7e29cba8ab32187c514e18f3be80618b57de0017a6
6
+ metadata.gz: 2af49818e9cc542c738e7474ffab8f823553e47e64bb4f3e09da15b3cd1ecf852cabc566505428067701ef26fc5d91147366f7ef93b067b2873897736b0922b7
7
+ data.tar.gz: '088e08c0f0847b27e49d262cc53be53124bda75d77541c0de42b20a6e3b57d074c2a30efd08921cbeb9b03f516af89b54988e4a6177dcfc013af5cf2e7b8174b'
data/README.md CHANGED
@@ -99,7 +99,7 @@ class User < ApplicationRecord
99
99
  end
100
100
  ```
101
101
 
102
- - Aspect ration validation:
102
+ - Aspect ratio validation:
103
103
 
104
104
  ```ruby
105
105
  class User < ApplicationRecord
@@ -236,6 +236,7 @@ You are welcome to contribute.
236
236
  - https://github.com/connorshea
237
237
  - https://github.com/Atul9
238
238
  - https://github.com/victorbueno
239
+ - https://github.com/UICJohn
239
240
 
240
241
  ## License
241
242
 
@@ -15,8 +15,8 @@ en:
15
15
  dimension_height_less_than_or_equal_to: "height must be less than or equal to %{length} pixel"
16
16
  dimension_width_equal_to: "width must be equal to %{length} pixel"
17
17
  dimension_height_equal_to: "height must be equal to %{length} pixel"
18
- aspect_ratio_not_square: "doesn't a square image"
19
- aspect_ratio_not_portrait: "doesn't contain a portrait image"
20
- aspect_ratio_not_landscape: "doesn't contain a landscape image"
21
- aspect_ratio_is_not: "doesn't contain aspect ratio of %{aspect_ratio}"
18
+ aspect_ratio_not_square: "must be a square image"
19
+ aspect_ratio_not_portrait: "must be a portrait image"
20
+ aspect_ratio_not_landscape: "must be a landscape image"
21
+ aspect_ratio_is_not: "must have an aspect ratio of %{aspect_ratio}"
22
22
  aspect_ratio_unknown: "has an unknown aspect ratio"
@@ -10,17 +10,13 @@ module ActiveStorageValidations
10
10
  raise ArgumentError, 'You must pass either :max or :min to the validator'
11
11
  end
12
12
 
13
- def validate_each(record, attribute, _value)
13
+ def validate_each(record, attribute, _)
14
14
  return true unless record.send(attribute).attached?
15
15
 
16
16
  files = Array.wrap(record.send(attribute))
17
-
18
- errors_options = {}
19
- errors_options[:min] = options[:min]
20
- errors_options[:max] = options[:max]
17
+ errors_options = { min: options[:min], max: options[:max] }
21
18
 
22
19
  return true if files_count_valid?(files.count)
23
-
24
20
  record.errors.add(attribute, options[:message].presence || :limit_out_of_range, errors_options)
25
21
  end
26
22
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveStorageValidations
4
- VERSION = '0.8.3'
4
+ VERSION = '0.8.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_storage_validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Kasyanchuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-03 00:00:00.000000000 Z
11
+ date: 2019-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails