administrate-field-active_storage 0.1.7 → 0.1.8
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5285346aa1dc6b65131ea17ef5a8a4da7e98ac8d
|
4
|
+
data.tar.gz: 9c9c2adcdd61a37a98619468d758d51ac68acd33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9876395df4d430f9342242e6d323a6be28d09ec136fab6f7261d752b551d71418dec39cbbfdc1a7fbf93f4b5db50728a01425ad217d4fb3a0c28c57b31d9810a
|
7
|
+
data.tar.gz: e3be245465e3974fea1c9f8e92ff9cbb0f67c907af424cb56e38dfbf579ebce97d409dc3f1c73cb88f8c47563efcf4375408c9fb290bc17f8d9a6bdaf2a5b4ef
|
data/README.md
CHANGED
@@ -52,6 +52,22 @@ class ModelDashboard < Administrate::BaseDashboard
|
|
52
52
|
```
|
53
53
|
I know it is not ideal, if you have a workaround please submit a PR.
|
54
54
|
|
55
|
+
### Prevent N+1 queries
|
56
|
+
In order to prevent N+1 queries from active storage you have to modify your admin model controller, below an example for a model called `User` and with attached avatars
|
57
|
+
```ruby
|
58
|
+
module Admin
|
59
|
+
class UsersController < Admin::ApplicationController
|
60
|
+
def index
|
61
|
+
super
|
62
|
+
@resources = User.with_attached_avatars.
|
63
|
+
page(params[:page]).
|
64
|
+
per(10)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
```
|
70
|
+
|
55
71
|
### Removing/Deleting an Attachment
|
56
72
|
In order to allow the user to delete an attachment using the admin dashboard you need to do the following:
|
57
73
|
1. create a controller action with a `delete` route
|
@@ -2,7 +2,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = "administrate-field-active_storage"
|
5
|
-
gem.version = "0.1.
|
5
|
+
gem.version = "0.1.8"
|
6
6
|
gem.authors = ["Hamad AlGhanim"]
|
7
7
|
gem.email = ["hamadyalghanim@gmail.com"]
|
8
8
|
gem.homepage = "https://github.com/Dreamersoul/administrate-field-active_storage"
|
data/contribute.md
CHANGED
@@ -4,4 +4,5 @@
|
|
4
4
|
- Mario Zigliotto [@mariozig](https://github.com/mariozig)
|
5
5
|
- Leif Gensert [@leifg](https://github.com/leifg)
|
6
6
|
- Kadu Diógenes [@cerdiogenes](https://github.com/cerdiogenes)
|
7
|
-
- Peter Bhat Harkins [@pushcx](https://github.com/pushcx)
|
7
|
+
- Peter Bhat Harkins [@pushcx](https://github.com/pushcx)
|
8
|
+
- Delta Purna Widyangga [@deltapurna](https://github.com/deltapurna)
|
@@ -3,12 +3,12 @@ module Admin
|
|
3
3
|
# To customize the behavior of this controller,
|
4
4
|
# you can overwrite any of the RESTful actions. For example:
|
5
5
|
#
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
def index
|
7
|
+
super
|
8
|
+
@resources = User.with_attached_avatars.
|
9
|
+
page(params[:page]).
|
10
|
+
per(10)
|
11
|
+
end
|
12
12
|
|
13
13
|
# Define a custom finder by overriding the `find_resource` method:
|
14
14
|
# def find_resource(param)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: administrate-field-active_storage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hamad AlGhanim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: administrate
|