active_storage_validations 0.8.3 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/config/locales/en.yml +4 -4
- data/lib/active_storage_validations/limit_validator.rb +2 -6
- data/lib/active_storage_validations/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: e849b34d9f400b0fcd81c54a90cb8da3c9ba6dd6ac20299d4269779462af037d
|
4
|
+
data.tar.gz: 69f0898b82531b842556e266fcd8c196194499754c3b99b699577f81f0e3ee0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
|
data/config/locales/en.yml
CHANGED
@@ -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: "
|
19
|
-
aspect_ratio_not_portrait: "
|
20
|
-
aspect_ratio_not_landscape: "
|
21
|
-
aspect_ratio_is_not: "
|
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,
|
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
|
|
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.
|
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-
|
11
|
+
date: 2019-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|