attache_client 0.0.1 → 0.0.2
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/README.md +26 -0
- data/lib/attache_client/version.rb +1 -1
- data/lib/attache_client.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abdd59a8e946383476ec8c58434d94d6ce7bf6e7
|
4
|
+
data.tar.gz: 6000e846b291c03ac6e342a07542c3c5f576d48f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc24bb5c8b9258028c6c26f9a8f0c784a53df709db4d4f18160222bf6d9f1335eaa4b489673384a7b4d7cb79e6279bbf2f049fc0b891c8e4b5b675ef043ceaa6
|
7
|
+
data.tar.gz: 965fa0058c8317449d2c4681dc382a07758c62423a7797982079d2fad88b371f7ee90d54af048ca035ca48e1cb48402c866cd47e9efdc9691b71cc0bf2ff57fc
|
data/README.md
CHANGED
@@ -82,6 +82,32 @@ Or if you're expecting multiple files uploaded, simply add `multiple: true`
|
|
82
82
|
|
83
83
|
NOTE: `64x64#` is just an example, you should define a suitable [geometry](http://www.imagemagick.org/Usage/resize/) for your form
|
84
84
|
|
85
|
+
### Strong Parameters
|
86
|
+
|
87
|
+
You'd need to permit the new field in your controller. For example, a strong parameters definition may look like this in your `Users` controller
|
88
|
+
|
89
|
+
``` ruby
|
90
|
+
def user_params
|
91
|
+
params.require(:user).permit(:name)
|
92
|
+
end
|
93
|
+
```
|
94
|
+
|
95
|
+
If you're only accepting a single file upload, change it to
|
96
|
+
|
97
|
+
``` ruby
|
98
|
+
def user_params
|
99
|
+
params.require(:user).permit(:name, :photo_path)
|
100
|
+
end
|
101
|
+
```
|
102
|
+
|
103
|
+
If you're accepting multiple file uploads via `multiple: true`, change it to
|
104
|
+
|
105
|
+
``` ruby
|
106
|
+
def user_params
|
107
|
+
params.require(:user).permit(:name, photo_path: [])
|
108
|
+
end
|
109
|
+
```
|
110
|
+
|
85
111
|
### Show
|
86
112
|
|
87
113
|
Use the `attache_urls` helper to obtain full urls for the values you've captured in your database.
|
data/lib/attache_client.rb
CHANGED
@@ -6,7 +6,7 @@ module AttacheClient
|
|
6
6
|
ATTACHE_DOWNLOAD_URL = ENV.fetch('ATTACHE_DOWNLOAD_URL') { 'http://localhost:9292/view' }
|
7
7
|
|
8
8
|
def attache_urls(json, geometry)
|
9
|
-
array = json.kind_of?(Array) ? json : [json]
|
9
|
+
array = json.kind_of?(Array) ? json : [*json]
|
10
10
|
array.collect do |path|
|
11
11
|
download_url = ATTACHE_DOWNLOAD_URL
|
12
12
|
prefix, basename = File.split(path)
|