shrine 2.15.0 → 2.16.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of shrine might be problematic. Click here for more details.

Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/doc/advantages.md +4 -0
  4. data/doc/plugins/activerecord.md +3 -2
  5. data/doc/plugins/add_metadata.md +4 -2
  6. data/doc/plugins/backgrounding.md +6 -4
  7. data/doc/plugins/backup.md +4 -2
  8. data/doc/plugins/cached_attachment_data.md +5 -3
  9. data/doc/plugins/copy.md +3 -1
  10. data/doc/plugins/data_uri.md +3 -2
  11. data/doc/plugins/default_storage.md +5 -2
  12. data/doc/plugins/default_url.md +4 -2
  13. data/doc/plugins/default_url_options.md +5 -2
  14. data/doc/plugins/delete_promoted.md +6 -4
  15. data/doc/plugins/delete_raw.md +12 -3
  16. data/doc/plugins/derivation_endpoint.md +17 -6
  17. data/doc/plugins/determine_mime_type.md +3 -2
  18. data/doc/plugins/direct_upload.md +4 -2
  19. data/doc/plugins/download_endpoint.md +46 -6
  20. data/doc/plugins/dynamic_storage.md +5 -2
  21. data/doc/plugins/hooks.md +3 -1
  22. data/doc/plugins/included.md +5 -2
  23. data/doc/plugins/infer_extension.md +5 -4
  24. data/doc/plugins/keep_files.md +5 -3
  25. data/doc/plugins/logging.md +4 -1
  26. data/doc/plugins/metadata_attribues.md +6 -3
  27. data/doc/plugins/migration_helpers.md +4 -2
  28. data/doc/plugins/module_include.md +4 -2
  29. data/doc/plugins/moving.md +6 -4
  30. data/doc/plugins/multi_delete.md +4 -2
  31. data/doc/plugins/parallelize.md +4 -2
  32. data/doc/plugins/parsed_json.md +5 -3
  33. data/doc/plugins/presign_endpoint.md +7 -5
  34. data/doc/plugins/pretty_location.md +4 -2
  35. data/doc/plugins/processing.md +3 -2
  36. data/doc/plugins/rack_file.md +4 -2
  37. data/doc/plugins/rack_response.md +26 -10
  38. data/doc/plugins/recache.md +7 -5
  39. data/doc/plugins/refresh_metadata.md +4 -2
  40. data/doc/plugins/remote_url.md +3 -1
  41. data/doc/plugins/remove_attachment.md +4 -2
  42. data/doc/plugins/remove_invalid.md +6 -3
  43. data/doc/plugins/restore_cached_data.md +8 -6
  44. data/doc/plugins/sequel.md +4 -1
  45. data/doc/plugins/signature.md +5 -3
  46. data/doc/plugins/store_dimensions.md +4 -2
  47. data/doc/plugins/tempfile.md +4 -2
  48. data/doc/plugins/upload_endpoint.md +4 -3
  49. data/doc/plugins/upload_options.md +4 -2
  50. data/doc/plugins/validation_helpers.md +4 -2
  51. data/doc/plugins/versions.md +3 -2
  52. data/doc/release_notes/2.15.0.md +2 -2
  53. data/doc/release_notes/2.16.0.md +52 -0
  54. data/doc/storage/s3.md +2 -2
  55. data/lib/shrine/plugins/_urlsafe_serialization.rb +2 -0
  56. data/lib/shrine/plugins/activerecord.rb +3 -0
  57. data/lib/shrine/plugins/add_metadata.rb +3 -0
  58. data/lib/shrine/plugins/backgrounding.rb +3 -0
  59. data/lib/shrine/plugins/backup.rb +3 -0
  60. data/lib/shrine/plugins/cached_attachment_data.rb +3 -0
  61. data/lib/shrine/plugins/copy.rb +3 -0
  62. data/lib/shrine/plugins/data_uri.rb +3 -0
  63. data/lib/shrine/plugins/default_storage.rb +3 -0
  64. data/lib/shrine/plugins/default_url.rb +3 -0
  65. data/lib/shrine/plugins/default_url_options.rb +3 -0
  66. data/lib/shrine/plugins/delete_promoted.rb +3 -0
  67. data/lib/shrine/plugins/delete_raw.rb +4 -1
  68. data/lib/shrine/plugins/derivation_endpoint.rb +144 -47
  69. data/lib/shrine/plugins/determine_mime_type.rb +3 -0
  70. data/lib/shrine/plugins/direct_upload.rb +3 -0
  71. data/lib/shrine/plugins/download_endpoint.rb +29 -29
  72. data/lib/shrine/plugins/dynamic_storage.rb +3 -0
  73. data/lib/shrine/plugins/hooks.rb +3 -0
  74. data/lib/shrine/plugins/included.rb +3 -0
  75. data/lib/shrine/plugins/infer_extension.rb +3 -0
  76. data/lib/shrine/plugins/keep_files.rb +3 -0
  77. data/lib/shrine/plugins/logging.rb +3 -0
  78. data/lib/shrine/plugins/metadata_attributes.rb +3 -0
  79. data/lib/shrine/plugins/migration_helpers.rb +3 -0
  80. data/lib/shrine/plugins/module_include.rb +3 -0
  81. data/lib/shrine/plugins/moving.rb +3 -0
  82. data/lib/shrine/plugins/multi_delete.rb +3 -0
  83. data/lib/shrine/plugins/parallelize.rb +5 -1
  84. data/lib/shrine/plugins/parsed_json.rb +3 -0
  85. data/lib/shrine/plugins/presign_endpoint.rb +3 -0
  86. data/lib/shrine/plugins/pretty_location.rb +3 -0
  87. data/lib/shrine/plugins/processing.rb +3 -0
  88. data/lib/shrine/plugins/rack_file.rb +3 -0
  89. data/lib/shrine/plugins/rack_response.rb +14 -14
  90. data/lib/shrine/plugins/recache.rb +3 -0
  91. data/lib/shrine/plugins/refresh_metadata.rb +3 -0
  92. data/lib/shrine/plugins/remote_url.rb +3 -0
  93. data/lib/shrine/plugins/remove_attachment.rb +3 -0
  94. data/lib/shrine/plugins/remove_invalid.rb +3 -0
  95. data/lib/shrine/plugins/restore_cached_data.rb +3 -0
  96. data/lib/shrine/plugins/sequel.rb +3 -0
  97. data/lib/shrine/plugins/signature.rb +3 -0
  98. data/lib/shrine/plugins/store_dimensions.rb +4 -1
  99. data/lib/shrine/plugins/tempfile.rb +5 -0
  100. data/lib/shrine/plugins/upload_endpoint.rb +3 -0
  101. data/lib/shrine/plugins/upload_options.rb +3 -0
  102. data/lib/shrine/plugins/validation_helpers.rb +3 -0
  103. data/lib/shrine/plugins/versions.rb +3 -0
  104. data/lib/shrine/uploaded_file.rb +15 -7
  105. data/lib/shrine/version.rb +1 -1
  106. metadata +3 -2
data/doc/plugins/hooks.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Hooks
2
2
 
3
- The `hooks` plugin allows you to trigger some code around
3
+ The [`hooks`][hooks] plugin allows you to trigger some code around
4
4
  processing/storing/deleting of each file.
5
5
 
6
6
  ```rb
@@ -54,3 +54,5 @@ class ImageUploader < Shrine
54
54
  end
55
55
  end
56
56
  ```
57
+
58
+ [hooks]: /lib/shrine/plugins/hooks.rb
@@ -1,7 +1,8 @@
1
1
  # Included
2
2
 
3
- The `included` plugin allows you to hook up to the `.included` hook of the
4
- attachment module, and call additional methods on the model which includes it.
3
+ The [`included`][included] plugin allows you to hook up to the `.included` hook
4
+ of the attachment module, and call additional methods on the model which
5
+ includes it.
5
6
 
6
7
  ```rb
7
8
  plugin :included do |name|
@@ -13,3 +14,5 @@ end
13
14
 
14
15
  If you want to define additional methods on the model, it's recommended to use
15
16
  the `module_include` plugin instead.
17
+
18
+ [included]: /lib/shrine/plugins/included.rb
@@ -1,9 +1,9 @@
1
1
  # Infer Extension
2
2
 
3
- The `infer_extension` plugin allows deducing the appropriate file extension for
4
- the upload location based on the MIME type of the file. This is useful when
5
- using `data_uri` and `remote_url` plugins, where the file extension might not
6
- be known.
3
+ The [`infer_extension`][infer_extension] plugin allows deducing the appropriate
4
+ file extension for the upload location based on the MIME type of the file. This
5
+ is useful when using `data_uri` and `remote_url` plugins, where the file
6
+ extension might not be known.
7
7
 
8
8
  ```rb
9
9
  plugin :infer_extension
@@ -53,5 +53,6 @@ Shrine.extension_inferrers[:mime_types].call("image/jpeg")
53
53
  # => ".jpeg"
54
54
  ```
55
55
 
56
+ [infer_extension]: /lib/shrine/plugins/infer_extension.rb
56
57
  [mime-types]: https://github.com/mime-types/ruby-mime-types
57
58
  [mini_mime]: https://github.com/discourse/mini_mime
@@ -1,8 +1,9 @@
1
1
  # Keep Files
2
2
 
3
- The `keep_files` plugin gives you the ability to prevent files from being
4
- deleted. This functionality is useful when implementing soft deletes, or when
5
- implementing some kind of [event store] where you need to track history.
3
+ The [`keep_files`][keep_files] plugin gives you the ability to prevent files
4
+ from being deleted. This functionality is useful when implementing soft
5
+ deletes, or when implementing some kind of [event store] where you need to
6
+ track history.
6
7
 
7
8
  The plugin accepts the following options:
8
9
 
@@ -17,4 +18,5 @@ For example, the following will keep destroyed and replaced files:
17
18
  plugin :keep_files, destroyed: true, replaced: true
18
19
  ```
19
20
 
21
+ [keep_files]: /lib/shrine/plugins/keep_files.rb
20
22
  [event store]: http://docs.geteventstore.com/introduction/event-sourcing-basics/
@@ -1,6 +1,7 @@
1
1
  # Logging
2
2
 
3
- The `logging` plugin logs any storing/processing/deleting that is performed.
3
+ The [`logging`][logging] plugin logs any storing/processing/deleting that is
4
+ performed.
4
5
 
5
6
  ```rb
6
7
  plugin :logging
@@ -37,3 +38,5 @@ plugin :logging, format: :logfmt
37
38
 
38
39
  Logging is by default disabled in tests, but you can enable it by setting
39
40
  `Shrine.logger.level = Logger::INFO`.
41
+
42
+ [logging]: /lib/shrine/plugins/logging.rb
@@ -1,8 +1,9 @@
1
1
  # Metadata Attributes
2
2
 
3
- The `metadata_attributes` plugin allows you to sync attachment metadata to
4
- additional record attributes. You can provide a hash of mappings to the plugin
5
- call itself or the `Attacher.metadata_attributes` method:
3
+ The [`metadata_attributes`][metadata_attributes] plugin allows you to sync
4
+ attachment metadata to additional record attributes. You can provide a hash of
5
+ mappings to the plugin call itself or the `Attacher.metadata_attributes`
6
+ method:
6
7
 
7
8
  ```rb
8
9
  plugin :metadata_attributes, :size => :size, :mime_type => :type
@@ -41,3 +42,5 @@ photo.original_filename #=> "nature.jpg"
41
42
 
42
43
  If any corresponding metadata attribute doesn't exist on the record, that
43
44
  metadata sync will be silently skipped.
45
+
46
+ [metadata_attributes]: /lib/shrine/plugins/metadata_attributes.rb
@@ -1,7 +1,7 @@
1
1
  # Migration Helpers
2
2
 
3
- The migration_helpers plugin gives the attacher additional helper methods which
4
- are convenient when doing file migrations.
3
+ The [`migration_helpers`][migration_helpers] plugin gives the attacher
4
+ additional helper methods which are convenient when doing file migrations.
5
5
 
6
6
  The plugin also allows convenient delegating to these methods through the
7
7
  model, by setting `:delegate`:
@@ -56,3 +56,5 @@ user.avatar_attacher.store #=> #<Shrine @storage_key=:store @storage=#<Shrine::S
56
56
  user.avatar_cache
57
57
  user.avatar_store
58
58
  ```
59
+
60
+ [migration_helpers]: /lib/shrine/plugins/migration_helpers.rb
@@ -1,7 +1,7 @@
1
1
  # Module Include
2
2
 
3
- The `module_include` plugin allows you to extend Shrine's core classes for the
4
- given uploader with modules/methods.
3
+ The [`module_include`][module_include] plugin allows you to extend Shrine's
4
+ core classes for the given uploader with modules/methods.
5
5
 
6
6
  ```rb
7
7
  plugin :module_include
@@ -38,3 +38,5 @@ end
38
38
 
39
39
  The above defines an additional `#<attachment>_size` method on the attachment
40
40
  module, which is what is included in your model.
41
+
42
+ [module_include]: /lib/shrine/plugins/module_include.rb
@@ -1,9 +1,9 @@
1
1
  # Moving
2
2
 
3
- The `moving` plugin will *move* files to storages instead of copying them, when
4
- the storage supports it. For FileSystem this will issue a `mv` command, which
5
- is instantaneous regardless of the filesize, so in that case loading this
6
- plugin can significantly speed up the attachment process.
3
+ The [`moving`][moving] plugin will *move* files to storages instead of copying
4
+ them, when the storage supports it. For FileSystem this will issue a `mv`
5
+ command, which is instantaneous regardless of the filesize, so in that case
6
+ loading this plugin can significantly speed up the attachment process.
7
7
 
8
8
  ```rb
9
9
  plugin :moving
@@ -15,3 +15,5 @@ moving to happen only for certain storages, you can set `:storages`:
15
15
  ```rb
16
16
  plugin :moving, storages: [:cache]
17
17
  ```
18
+
19
+ [moving]: /lib/shrine/plugins/moving.rb
@@ -1,7 +1,7 @@
1
1
  # Multi Delete
2
2
 
3
- The `multi_delete` plugins allows you to leverage your storage's multi delete
4
- capabilities.
3
+ The [`multi_delete`][multi_delete] plugins allows you to leverage your
4
+ storage's multi delete capabilities.
5
5
 
6
6
  ```rb
7
7
  plugin :multi_delete
@@ -16,3 +16,5 @@ uploader.delete([file1, file2, file3])
16
16
  Now if you're using Storage::S3, deleting an array of files will issue a single
17
17
  HTTP request. Some other storages may support multi deletes as well. The
18
18
  `versions` plugin uses this plugin for deleting multiple versions at once.
19
+
20
+ [multi_delete]: /lib/shrine/plugins/multi_delete.rb
@@ -1,7 +1,7 @@
1
1
  # Parallelize
2
2
 
3
- The `parallelize` plugin parallelizes uploads and deletes of multiple versions
4
- using threads.
3
+ The [`parallelize`][parallelize] plugin parallelizes uploads and deletes of
4
+ multiple versions using threads.
5
5
 
6
6
  ```rb
7
7
  plugin :parallelize
@@ -12,3 +12,5 @@ By default a pool of 3 threads will be used, but you can change that:
12
12
  ```rb
13
13
  plugin :parallelize, threads: 5
14
14
  ```
15
+
16
+ [parallelize]: /lib/shrine/plugins/parallelize.rb
@@ -1,9 +1,11 @@
1
1
  # Parsed JSON
2
2
 
3
- The `parsed_json` plugin is suitable for the case when your framework is
4
- automatically parsing JSON query parameters, allowing you to assign cached
5
- files with hashes/arrays.
3
+ The [`parsed_json`][parsed_json] plugin is suitable for the case when your
4
+ framework is automatically parsing JSON query parameters, allowing you to
5
+ assign cached files with hashes/arrays.
6
6
 
7
7
  ```rb
8
8
  plugin :parsed_json
9
9
  ```
10
+
11
+ [parsed_json]: /lib/shrine/plugins/parsed_json.rb
@@ -1,10 +1,11 @@
1
1
  # Presign Endpoint
2
2
 
3
- The `presign_endpoint` plugin provides a Rack endpoint which generates the URL,
4
- fields, and headers that can be used to upload files directly to a storage
5
- service. On the client side it's recommended to use [Uppy] for asynchronous
6
- uploads. Storage services that support direct uploads include [Amazon S3],
7
- [Google Cloud Storage], [Microsoft Azure Storage] and more.
3
+ The [`presign_endpoint`][presign_endpoint] plugin provides a Rack endpoint
4
+ which generates the URL, fields, and headers that can be used to upload files
5
+ directly to a storage service. On the client side it's recommended to use
6
+ [Uppy] for asynchronous uploads. Storage services that support direct uploads
7
+ include [Amazon S3], [Google Cloud Storage], [Microsoft Azure Storage] and
8
+ more.
8
9
 
9
10
  ```rb
10
11
  plugin :presign_endpoint
@@ -126,6 +127,7 @@ You can override any of the options above when creating the endpoint:
126
127
  Shrine.presign_endpoint(:cache, presign_location: "${filename}")
127
128
  ```
128
129
 
130
+ [presign_endpoint]: /lib/shrine/plugins/presign_endpoint.rb
129
131
  [Uppy]: https://uppy.io
130
132
  [Amazon S3]: https://aws.amazon.com/s3/
131
133
  [Google Cloud Storage]: https://cloud.google.com/storage/
@@ -1,7 +1,7 @@
1
1
  # Pretty Location
2
2
 
3
- The `pretty_location` plugin attempts to generate a nicer folder structure for
4
- uploaded files.
3
+ The [`pretty_location`][pretty_location] plugin attempts to generate a nicer
4
+ folder structure for uploaded files.
5
5
 
6
6
  ```rb
7
7
  plugin :pretty_location
@@ -27,3 +27,5 @@ plugin :pretty_location, namespace: "_"
27
27
  plugin :pretty_location, namespace: "/"
28
28
  # "blog/user/.../493g82jf23.jpg"
29
29
  ```
30
+
31
+ [pretty_location]: /lib/shrine/plugins/pretty_location.rb
@@ -22,8 +22,8 @@ def process(io, context)
22
22
  end
23
23
  ```
24
24
 
25
- The `processing` plugin simplifies this by allowing us to declaratively define
26
- file processing for specified actions.
25
+ The [`processing`][processing] plugin simplifies this by allowing us to
26
+ declaratively define file processing for specified actions.
27
27
 
28
28
  ```rb
29
29
  plugin :processing
@@ -65,4 +65,5 @@ uploader.process(file, action: :store) # only process
65
65
  If you want the result of processing to be multiple files, use the `versions`
66
66
  plugin.
67
67
 
68
+ [processing]: /lib/shrine/plugins/processing.rb
68
69
  [image_processing]: https://github.com/janko/image_processing
@@ -1,7 +1,7 @@
1
1
  # Rack File
2
2
 
3
- The `rack_file` plugin enables uploaders to accept Rack uploaded file hashes
4
- for uploading.
3
+ The [`rack_file`][rack_file] plugin enables uploaders to accept Rack uploaded
4
+ file hashes for uploading.
5
5
 
6
6
  ```rb
7
7
  plugin :rack_file
@@ -47,3 +47,5 @@ io.size #=> 58342
47
47
  Note that this plugin is not needed in Rails applications, as Rails already
48
48
  wraps the Rack uploaded file hash into an `ActionDispatch::Http::UploadedFile`
49
49
  object.
50
+
51
+ [rack_file]: /lib/shrine/plugins/rack_file.rb
@@ -1,8 +1,8 @@
1
1
  # Rack Response
2
2
 
3
- The `rack_response` plugin allows you to convert an `UploadedFile` object into
4
- a triple consisting of status, headers, and body, suitable for returning as a
5
- response in a Rack-based application.
3
+ The [`rack_response`][rack_response] plugin allows you to convert an
4
+ `UploadedFile` object into a triple consisting of status, headers, and body,
5
+ suitable for returning as a response in a Rack-based application.
6
6
 
7
7
  ```rb
8
8
  plugin :rack_response
@@ -53,8 +53,8 @@ The response `Content-Type` header will default to the value of the `mime_type`
53
53
  metadata. A custom content type can be provided via the `:type` option:
54
54
 
55
55
  ```rb
56
- _, headers, _ uploaded_file.to_rack_response(type: "text/plain; charset=utf-8")
57
- headers["Content-Type"] #=> "text/plain; charset=utf-8"
56
+ response = uploaded_file.to_rack_response(type: "text/plain; charset=utf-8")
57
+ response[1]["Content-Type"] #=> "text/plain; charset=utf-8"
58
58
  ```
59
59
 
60
60
  ## Filename
@@ -64,8 +64,8 @@ value of the `filename` metadata. A custom download filename can be provided
64
64
  via the `:filename` option:
65
65
 
66
66
  ```rb
67
- _, headers, _ uploaded_file.to_rack_response(filename: "my-filename.txt")
68
- headers["Content-Disposition"] #=> "inline; filename=\"my-filename.txt\""
67
+ response = uploaded_file.to_rack_response(filename: "my-filename.txt")
68
+ response[1]["Content-Disposition"] #=> "inline; filename=\"my-filename.txt\""
69
69
  ```
70
70
 
71
71
  ## Disposition
@@ -74,8 +74,8 @@ The default disposition in the "Content-Disposition" header is `inline`, but it
74
74
  can be changed via the `:disposition` option:
75
75
 
76
76
  ```rb
77
- _, headers, _ = uploaded_file.to_rack_response(disposition: "attachment")
78
- headers["Content-Disposition"] #=> "attachment; filename=\"file.txt\""
77
+ response = uploaded_file.to_rack_response(disposition: "attachment")
78
+ response[1]["Content-Disposition"] #=> "attachment; filename=\"file.txt\""
79
79
  ```
80
80
 
81
81
  ## Range
@@ -84,7 +84,6 @@ headers["Content-Disposition"] #=> "attachment; filename=\"file.txt\""
84
84
  which accepts a value of the `Range` request header.
85
85
 
86
86
  ```rb
87
- env["HTTP_RANGE"] #=> "bytes=100-200"
88
87
  status, headers, body = uploaded_file.to_rack_response(range: env["HTTP_RANGE"])
89
88
  status #=> 206
90
89
  headers["Content-Length"] #=> "101"
@@ -92,5 +91,22 @@ headers["Content-Range"] #=> "bytes 100-200/1000"
92
91
  body # partial content
93
92
  ```
94
93
 
94
+ ## Download options
95
+
96
+ The `#to_rack_response` method will automatically open the `UploadedFile` if it
97
+ hasn't been opened yet. If you want to pass additional download options to the
98
+ storage, you can explicitly call `UploadedFile#open` beforehand:
99
+
100
+ ```rb
101
+ uploaded_file.open(
102
+ sse_customer_algorithm: "AES256",
103
+ sse_customer_key: "secret_key",
104
+ sse_customer_key_md5: "secret_key_md5",
105
+ )
106
+
107
+ uploaded_file.to_rack_response
108
+ ```
109
+
110
+ [rack_response]: /lib/shrine/plugins/rack_response.rb
95
111
  [range requests]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests
96
112
  [Rack::Sendfile]: https://www.rubydoc.info/github/rack/rack/Rack/Sendfile
@@ -1,10 +1,10 @@
1
1
  # Re-cache
2
2
 
3
- The `recache` plugin allows you to process your attachment after validations
4
- succeed, but before the attachment is promoted. This is useful for example when
5
- you want to generate some versions upfront (so the user immediately sees them)
6
- and other versions you want to generate in the promotion phase in a background
7
- job.
3
+ The [`recache`][recache] plugin allows you to process your attachment after
4
+ validations succeed, but before the attachment is promoted. This is useful for
5
+ example when you want to generate some versions upfront (so the user
6
+ immediately sees them) and other versions you want to generate in the promotion
7
+ phase in a background job.
8
8
 
9
9
  ```rb
10
10
  plugin :recache
@@ -25,3 +25,5 @@ you're using the attacher directly, you can call it manually:
25
25
  ```rb
26
26
  attacher.recache if attacher.changed?
27
27
  ```
28
+
29
+ [recache]: /lib/shrine/plugins/recache.rb
@@ -1,7 +1,7 @@
1
1
  # Refresh Metadata
2
2
 
3
- The `refresh_metadata` plugin allows you to re-extract metadata from an
4
- uploaded file.
3
+ The [`refresh_metadata`][refresh_metadata] plugin allows you to re-extract
4
+ metadata from an uploaded file.
5
5
 
6
6
  ```rb
7
7
  plugin :refresh_metadata
@@ -29,3 +29,5 @@ uploaded_file.open do
29
29
  # ...
30
30
  end
31
31
  ```
32
+
33
+ [refresh_metadata]: /lib/shrine/plugins/refresh_metadata.rb
@@ -1,6 +1,7 @@
1
1
  # Remote URL
2
2
 
3
- The `remote_url` plugin allows you to attach files from a remote location.
3
+ The [`remote_url`][remote_url] plugin allows you to attach files from a remote
4
+ location.
4
5
 
5
6
  ```rb
6
7
  plugin :remote_url, max_size: 20*1024*1024
@@ -100,5 +101,6 @@ load the `infer_extension` plugin to infer it from the MIME type.
100
101
  plugin :infer_extension
101
102
  ```
102
103
 
104
+ [remote_url]: /lib/shrine/plugins/remote_url.rb
103
105
  [Down]: https://github.com/janko/down
104
106
  [shrine-url]: https://github.com/shrinerb/shrine-url
@@ -1,7 +1,7 @@
1
1
  # Remove Attachment
2
2
 
3
- The `remove_attachment` plugin allows you to delete attachments through
4
- checkboxes on the web form.
3
+ The [`remove_attachment`][remove_attachment] plugin allows you to delete
4
+ attachments through checkboxes on the web form.
5
5
 
6
6
  ```rb
7
7
  plugin :remove_attachment
@@ -14,3 +14,5 @@ to add a form field for removing attachments:
14
14
  ```rb
15
15
  form.check_box :remove_avatar
16
16
  ```
17
+
18
+ [remove_attachment]: /lib/shrine/plugins/remove_attachment.rb
@@ -1,9 +1,12 @@
1
1
  # Remove Invalid
2
2
 
3
- The `remove_invalid` plugin automatically deletes a new assigned file if it was
4
- invalid and deassigns it from the record. If there was a previous file
5
- attached, it will be assigned back, otherwise no attachment will be assigned.
3
+ The [`remove_invalid`][remove_invalid] plugin automatically deletes a new
4
+ assigned file if it was invalid and deassigns it from the record. If there was
5
+ a previous file attached, it will be assigned back, otherwise no attachment
6
+ will be assigned.
6
7
 
7
8
  ```rb
8
9
  plugin :remove_invalid
9
10
  ```
11
+
12
+ [remove_invalid]: /lib/shrine/plugins/remove_invalid.rb