trestle-active_storage 0.0.1.pre.3 → 0.0.1.pre.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 350fc548afdfb1dc065e0f633fc698210b770f6b867d457d40a324c228b6ea08
|
4
|
+
data.tar.gz: 70890ea96e1d62a19325c278c6dfa9396ac6f028119187fa68e70bf24ba27b63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3752d6ec1a0203f7e838cf621d3b24fce9518481a17a5f7884a47c28a9946a3d8e93aa4fa3364e401bb7c7da73f3b9843e99b0e90894b7948d89466f9c3e4ca9
|
7
|
+
data.tar.gz: 061f069fabfa556b02d9fc7bcdfce9e606ab54395a01f9f29468246d035dbe550442737c352b85b301bd3bcb871b2710bba72cc91b0ee9dd00678521e5183065
|
@@ -4,6 +4,7 @@ module Trestle
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
6
|
included do
|
7
|
+
before_action :define_attachment_accessors, only: [:edit, :update]
|
7
8
|
before_action :delete_attachment_params, only: [:create, :update]
|
8
9
|
after_action :attach_attachments, only: %i[create update]
|
9
10
|
after_action :purge_attachments, only: %i[update]
|
@@ -11,6 +12,14 @@ module Trestle
|
|
11
12
|
|
12
13
|
protected
|
13
14
|
|
15
|
+
def define_attachment_accessors
|
16
|
+
self.instance = admin.find_instance(params)
|
17
|
+
|
18
|
+
admin.active_storage_fields.each do |field|
|
19
|
+
instance.class.send(:attr_accessor, "delete_#{field}")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
14
23
|
def delete_attachment_params
|
15
24
|
admin.active_storage_fields.each { |field| params.delete(field) }
|
16
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trestle-active_storage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.pre.
|
4
|
+
version: 0.0.1.pre.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Venneman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|