simple_active_storage 0.1.3 → 0.1.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/lib/simple_active_storage/attached.rb +26 -0
- data/lib/simple_active_storage/version.rb +1 -1
- data/lib/simple_active_storage.rb +5 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea0f48286ef738d92dd4ba0c4d1311a382b0cd66
|
4
|
+
data.tar.gz: 662fbbc5aff26193ab6f886fb58e277f0aa63363
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 239eb1a13b25ac140b29165a815cff53d5a38b6475323389d5ca181741faec2559550f1b8e5e44e5c5885497c51f098a14fd1cd5889874b00f708b7ab723fba3
|
7
|
+
data.tar.gz: 73674b4e1682dd479b5f6013f5b75bc7b200380aebd6d7d3d8cb2c8b3ce23cbd15ac2ece4b455b3e3ca7fbbb411f578d8187b8c65f09a4315188a7cca1e288e1
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# 假设单个图片为picture
|
2
|
+
# 多个图片为pictures
|
3
|
+
module SimpleActiveStorage
|
4
|
+
module Attached
|
5
|
+
module Many
|
6
|
+
def attach(*attachables)
|
7
|
+
record.try(:before_active_storage_attach,attachables)
|
8
|
+
result = super(*attachables)
|
9
|
+
record.try(:after_active_storage_attach,{name: name, attachments: attachments})
|
10
|
+
result
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
module One
|
16
|
+
def attach(attachable)
|
17
|
+
record.try(:before_active_storage_attach,attachable)
|
18
|
+
result = super attachable
|
19
|
+
record.try(:after_active_storage_attach,{name: name, attachment: attachment})
|
20
|
+
result
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -2,8 +2,13 @@ require "simple_active_storage/railtie"
|
|
2
2
|
require "simple_active_storage/variation"
|
3
3
|
require "simple_active_storage/url"
|
4
4
|
require "simple_active_storage/direct_uploads_controller"
|
5
|
+
require "simple_active_storage/attached"
|
5
6
|
|
6
7
|
module SimpleActiveStorage
|
7
8
|
# Your code goes here...
|
8
9
|
include ActiveSupport::Configurable
|
9
10
|
end
|
11
|
+
|
12
|
+
|
13
|
+
ActiveStorage::Attached::One.prepend SimpleActiveStorage::Attached::One
|
14
|
+
ActiveStorage::Attached::Many.prepend SimpleActiveStorage::Attached::Many
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_active_storage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aotianlong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- lib/generators/simple_active_storage/simple_active_storage_generator.rb
|
53
53
|
- lib/generators/simple_active_storage/templates/simple_active_storage.rb
|
54
54
|
- lib/simple_active_storage.rb
|
55
|
+
- lib/simple_active_storage/attached.rb
|
55
56
|
- lib/simple_active_storage/direct_uploads_controller.rb
|
56
57
|
- lib/simple_active_storage/railtie.rb
|
57
58
|
- lib/simple_active_storage/url.rb
|
@@ -78,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
79
|
version: '0'
|
79
80
|
requirements: []
|
80
81
|
rubyforge_project:
|
81
|
-
rubygems_version: 2.6.
|
82
|
+
rubygems_version: 2.6.12
|
82
83
|
signing_key:
|
83
84
|
specification_version: 4
|
84
85
|
summary: add shortcut variant support for active storage
|