shrine 0.9.0 → 1.0.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.

@@ -1,25 +0,0 @@
1
- class Shrine
2
- module Plugins
3
- # The delete_invalid plugin immediately deletes the assigned attachment if
4
- # it failed validation.
5
- #
6
- # plugin :delete_invalid
7
- #
8
- # By default an attachment is always cached before it's validated. This
9
- # way the attachment will persist when the form is resubmitted, which is
10
- # consistent with the other fields in the form. However, if this is a
11
- # concern, you can load this plugin.
12
- module DeleteInvalid
13
- module AttacherMethods
14
- # Delete the assigned uploaded file if it was invalid.
15
- def validate
16
- super
17
- ensure
18
- delete!(get, phase: :invalid) if !errors.empty?
19
- end
20
- end
21
- end
22
-
23
- register_plugin(:delete_invalid, DeleteInvalid)
24
- end
25
- end