active_shrine 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/active_shrine/attachment.rb +2 -2
- data/lib/active_shrine/model.rb +12 -2
- data/lib/active_shrine/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 756c7f37f8450e532d53547e256301bdb3368e6ce8b27248566a051d7a0ab880
|
4
|
+
data.tar.gz: 8d089b85b9a0d4ff6b80b5088f45a35daa2fc3218897a6b02938e507210f10e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b9bfe585f6ded80b0dfa17626eec1a74c6d2fc82e67b519dd0363df5baa6199681e814ca80a9240c18c9b2229aa775efecacf35bb86ba773887f049f8dd68ec
|
7
|
+
data.tar.gz: 351afd5f4ab728e5313e3d57a4691b319ad5ecae8c21cc36b98cc2ccd0806ac13a00fc90545bc98617452bd96a69e183e991ae40b72db2ef8cb27ea62e080cae
|
data/README.md
CHANGED
@@ -121,7 +121,7 @@ After checking out the repo:
|
|
121
121
|
4. Push to the branch (`git push origin my-new-feature`)
|
122
122
|
5. Create new Pull Request
|
123
123
|
|
124
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
124
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/radioactive-labs/active_shrine.
|
125
125
|
|
126
126
|
## License
|
127
127
|
|
@@ -129,4 +129,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
129
129
|
|
130
130
|
## Code of Conduct
|
131
131
|
|
132
|
-
Everyone interacting in the ActiveShrine project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/active_shrine/blob/main/CODE_OF_CONDUCT.md).
|
132
|
+
Everyone interacting in the ActiveShrine project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/active_shrine/blob/main/CODE_OF_CONDUCT.md).
|
data/lib/active_shrine/model.rb
CHANGED
@@ -137,7 +137,12 @@ module ActiveShrine
|
|
137
137
|
|
138
138
|
scope :"with_attached_#{name}", -> { includes(:"#{name}_attachment") }
|
139
139
|
|
140
|
-
after_save
|
140
|
+
after_save do
|
141
|
+
shrine_attachment_changes[name.to_s]&.save
|
142
|
+
rescue => e
|
143
|
+
errors.add(name, :invalid, message: "failed to save. Please make sure it is a valid file.")
|
144
|
+
raise ActiveRecord::RecordInvalid.new(self)
|
145
|
+
end
|
141
146
|
|
142
147
|
after_commit(on: %i[create update]) { shrine_attachment_changes.delete(name.to_s) }
|
143
148
|
|
@@ -232,7 +237,12 @@ module ActiveShrine
|
|
232
237
|
|
233
238
|
scope :"with_attached_#{name}", -> { includes(:"#{name}_attachments") }
|
234
239
|
|
235
|
-
after_save
|
240
|
+
after_save do
|
241
|
+
shrine_attachment_changes[name.to_s]&.save
|
242
|
+
rescue => e
|
243
|
+
errors.add(name, :invalid, message: "failed to save. Please make sure it is a valid file.")
|
244
|
+
raise ActiveRecord::RecordInvalid.new(self)
|
245
|
+
end
|
236
246
|
|
237
247
|
after_commit(on: %i[create update]) { shrine_attachment_changes.delete(name.to_s) }
|
238
248
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_shrine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Radioactive Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-02-
|
11
|
+
date: 2025-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|