active_storage_validations 0.8.9 → 0.9.0

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: 56d4f3fe66fc5eeb5ba573218aa39cea1bf41a2a579795f3a52d904cd02a0e99
4
- data.tar.gz: f8a7a311d1ea36080cfe20e9ffda3891720d0c2cf997aaa8d9bb272917137e8b
3
+ metadata.gz: 63ae1be092a1780d41de3af6c4189ee9e92804ce53b9fb30f91c929eb4c2efc6
4
+ data.tar.gz: 73e74ca24800fc11bbdc3b0b95e2f044311b96728cb7da30209c00af77e45b32
5
5
  SHA512:
6
- metadata.gz: 99f3f5c47db60e580e7d7d30ed44082871258ac7a64b6dd300ff8cb5d1b6f3272e03e0f4448e4ed994604909ff87ef38fc41711f5e2f09ddf4706a5ff79f1721
7
- data.tar.gz: d264bd552bad53dc5487eeb80235187da2c5d1f6b395621510f128753fbb5e832d6a3caa6819fa4f72c244898509163519309671803063e0b88b050607f73809
6
+ metadata.gz: c701c6d1db92c8d0db7ca00616a6247462abe94486d73dcb71c0d41e99f82081af8cfe84fb7f2d56a719dc70fe47d696208ee372a26dfed770dc0cf9106eafd3
7
+ data.tar.gz: b437692cf0c6d11e4ad341c413c448e825bd29537696d885cdb6fbe30fd8a1b9b56d724cbaee41c9b3656b7261544b00d89cbaa809d69773d1786b21fad77d1a
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Active Storage Validations
2
2
 
3
- If you are using `active_storage` gem and you want to add simple validations for it, like presence or content_type you need to write a custom valiation method.
3
+ If you are using `active_storage` gem and you want to add simple validations for it, like presence or content_type you need to write a custom validation method.
4
4
 
5
5
  This gems doing it for you. Just use `attached: true` or `content_type: 'image/png'` validation.
6
6
 
@@ -330,6 +330,8 @@ You are welcome to contribute.
330
330
  - https://github.com/mohanklein
331
331
  - https://github.com/High5Apps
332
332
  - https://github.com/mschnitzer
333
+ - https://github.com/sinankeskin
334
+ - https://github.com/alejandrodevs
333
335
 
334
336
  ## License
335
337
 
@@ -0,0 +1,22 @@
1
+ tr:
2
+ errors:
3
+ messages:
4
+ content_type_invalid: "geçersiz dosya tipine sahip"
5
+ file_size_out_of_range: "dosya boyutu %{file_size} gerekli aralık dışında"
6
+ limit_out_of_range: "toplam miktar aralık dışında"
7
+ image_metadata_missing: "geçerli bir imaj değil"
8
+ dimension_min_inclusion: "%{width} x %{height} piksele eşit ya da büyük olmalı"
9
+ dimension_max_inclusion: "%{width} x %{height} piksele eşit ya da küçük olmalı"
10
+ dimension_width_inclusion: "en %{min} ve %{max} piksel aralığı dışında"
11
+ dimension_height_inclusion: "boy %{min} ve %{max} piksel aralığı dışında"
12
+ dimension_width_greater_than_or_equal_to: "en %{length} piksele eşit ya da büyük olmalı"
13
+ dimension_height_greater_than_or_equal_to: "boy %{length} piksele eşit ya da büyük olmalı"
14
+ dimension_width_less_than_or_equal_to: "en %{length} piksele eşit ya da küçük olmalı"
15
+ dimension_height_less_than_or_equal_to: "boy %{length} piksele eşit ya da küçük olmalı"
16
+ dimension_width_equal_to: "en %{length} piksele eşit olmalı"
17
+ dimension_height_equal_to: "boy %{length} piksele eşit olmalı"
18
+ aspect_ratio_not_square: "kare bir imaj olmalı"
19
+ aspect_ratio_not_portrait: "dikey bir imaj olmalı"
20
+ aspect_ratio_not_landscape: "yatay bir imaj olmalı"
21
+ aspect_ratio_is_not: "%{aspect_ratio} en boy oranına sahip olmalı"
22
+ aspect_ratio_unknown: "bilinmeyen en boy oranı"
@@ -16,8 +16,7 @@ module ActiveStorageValidations
16
16
  end
17
17
 
18
18
  def matches?(subject)
19
- @subject = subject.is_a?(Class) ? subject : subject.class
20
-
19
+ @subject = subject.is_a?(Class) ? subject.new : subject
21
20
  invalid_when_not_attached && valid_when_attached
22
21
  end
23
22
 
@@ -32,14 +31,14 @@ module ActiveStorageValidations
32
31
  private
33
32
 
34
33
  def valid_when_attached
35
- instance = @subject.new
34
+ instance = @subject
36
35
  instance.public_send(@attribute_name).attach(attachable)
37
36
  instance.validate
38
37
  instance.errors.details[@attribute_name].exclude?(error: :blank)
39
38
  end
40
39
 
41
40
  def invalid_when_not_attached
42
- instance = @subject.new
41
+ instance = @subject
43
42
  instance.validate
44
43
  instance.errors.details[@attribute_name].include?(error: :blank)
45
44
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveStorageValidations
4
- VERSION = '0.8.9'
4
+ VERSION = '0.9.0'
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.9
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Kasyanchuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-16 00:00:00.000000000 Z
11
+ date: 2020-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: coffee-rails
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
83
  description: Validations for Active Storage (presence)
98
84
  email:
99
85
  - igorkasyanchuk@gmail.com
@@ -110,6 +96,7 @@ files:
110
96
  - config/locales/ja.yml
111
97
  - config/locales/pt-BR.yml
112
98
  - config/locales/ru.yml
99
+ - config/locales/tr.yml
113
100
  - config/locales/uk.yml
114
101
  - lib/active_storage_validations.rb
115
102
  - lib/active_storage_validations/aspect_ratio_validator.rb