activestorage-validator 0.3.0 → 0.4.0
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/.github/workflows/rspec.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/activestorage-validator.gemspec +2 -0
- data/lib/activestorage/validator/blob.rb +2 -0
- data/lib/activestorage/validator/version.rb +1 -1
- data/lib/activestorage/validator.rb +0 -11
- metadata +3 -4
- data/.travis.yml +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c09a9b8ded80c3fe2be9547622aa8408fbdd9c7cd4a1beee2ab1425809f62ba9
|
4
|
+
data.tar.gz: 841c661ce228726b1fa7c28adcabe006bb561c50122e317b9fb628b8ebfc6630
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ec8362922c900e8ace6185e8c23a40a8a366c671a341397189e6035eeda0c1ca8826d49ae0d244bcbcaa655d2dbe6df367640914bb5e0edf54d143be03ecb5c
|
7
|
+
data.tar.gz: 3528baa631ad61e40c0a04785dd92bbc60af1b442d843be91956a64c9db082085aa6ea15024ee4f37e026aeb88bfcee8e05c2a8561be422a6768a427831bc48d
|
data/.github/workflows/rspec.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -28,7 +28,7 @@ class User < ApplicationRecord
|
|
28
28
|
has_one_attached :avatar
|
29
29
|
has_many_attached :photos
|
30
30
|
|
31
|
-
validates :avatar, presence: true, blob: { content_type: :
|
31
|
+
validates :avatar, presence: true, blob: { content_type: :web_image } # supported options: :web_image, :image, :audio, :video, :text
|
32
32
|
validates :photos, presence: true, blob: { content_type: ['image/png', 'image/jpg', 'image/jpeg'], size_range: 1..(5.megabytes) }
|
33
33
|
# validates :photos, presence: true, blob: { content_type: %r{^image/}, size_range: 1..(5.megabytes) }
|
34
34
|
end
|
@@ -23,6 +23,8 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = ["lib"]
|
25
25
|
|
26
|
+
spec.required_ruby_version = '>= 3.0.0'
|
27
|
+
|
26
28
|
spec.add_dependency "rails", ">= 6.1.0"
|
27
29
|
spec.add_development_dependency "bundler", "~> 2.0"
|
28
30
|
spec.add_development_dependency "rake", ">= 12.3.3"
|
@@ -29,6 +29,8 @@ module ActiveRecord
|
|
29
29
|
options[:content_type].match?(blob.content_type)
|
30
30
|
when Array
|
31
31
|
options[:content_type].include?(blob.content_type)
|
32
|
+
when :web_image
|
33
|
+
ActiveStorage.web_image_content_types.include?(blob.content_type)
|
32
34
|
when Symbol
|
33
35
|
blob.public_send("#{options[:content_type]}?")
|
34
36
|
else
|
@@ -4,15 +4,4 @@ ActiveSupport.on_load(:active_record) do
|
|
4
4
|
require 'activestorage/validator/blob'
|
5
5
|
end
|
6
6
|
|
7
|
-
module ActiveStorage
|
8
|
-
# https://github.com/rails/rails/commit/42259ce904eb2538761b32a793cbe390fb8272b7
|
9
|
-
if Rails::VERSION::MAJOR < 6
|
10
|
-
class Attached::One < Attached
|
11
|
-
def blank?
|
12
|
-
attachment.blank?
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
7
|
I18n.load_path += Dir[File.expand_path(File.join(__dir__, '../../config/locales', '*.yml')).to_s]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activestorage-validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -91,7 +91,6 @@ files:
|
|
91
91
|
- ".github/workflows/rspec.yml"
|
92
92
|
- ".gitignore"
|
93
93
|
- ".rspec"
|
94
|
-
- ".travis.yml"
|
95
94
|
- CHANGELOG.md
|
96
95
|
- CODE_OF_CONDUCT.md
|
97
96
|
- Gemfile
|
@@ -126,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
125
|
requirements:
|
127
126
|
- - ">="
|
128
127
|
- !ruby/object:Gem::Version
|
129
|
-
version:
|
128
|
+
version: 3.0.0
|
130
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
130
|
requirements:
|
132
131
|
- - ">="
|