carrierwave-base64 2.9.0 → 2.10.0
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/CHANGELOG.md +4 -0
- data/lib/carrierwave/base64/adapter.rb +9 -2
- data/lib/carrierwave/base64/version.rb +1 -1
- data/spec/adapter_spec.rb +19 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcc0254f7258899a78ff178e32c60221aea32cf3551a1dc0702ff1675645024b
|
4
|
+
data.tar.gz: dc0f4f9de01fe428086ac3a3289ae808e53c2a0f80713cee51b8ef177ad542d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e9df88c09c107a39403c969dedd523e7bcd9a152bdcb548ee3250ea63b4e8498b80a33a52903f66530f4ba95bc61c3b63081de7c08e64f62779613cc9ff486c
|
7
|
+
data.tar.gz: d104d6d00b5ee4b3772dd696f9136c0d3335aa460d3fd8543fa484050c22817a1189b21d731a748960f14fbf550c5b060f8e353c137017cda5377be19811a215
|
data/CHANGELOG.md
CHANGED
@@ -17,9 +17,16 @@ module Carrierwave
|
|
17
17
|
# mount_base64_uploader :image, ImageUploader,
|
18
18
|
# file_name: -> (u) { u.username }
|
19
19
|
#
|
20
|
+
# @example Mount the uploader with a block, overriding the store_dir
|
21
|
+
# mount_base64_uploader :image, ImageUploader do
|
22
|
+
# def store_dir
|
23
|
+
# 'images'
|
24
|
+
# end
|
25
|
+
# end
|
26
|
+
#
|
20
27
|
# @return [Symbol] the defined writer method name
|
21
|
-
def mount_base64_uploader(attribute, uploader_class, options = {})
|
22
|
-
mount_uploader attribute, uploader_class, options
|
28
|
+
def mount_base64_uploader(attribute, uploader_class, options = {}, &block)
|
29
|
+
mount_uploader attribute, uploader_class, options, &block
|
23
30
|
options[:file_name] ||= proc { attribute }
|
24
31
|
|
25
32
|
Carrierwave::Base64::MountingHelper.check_for_deprecations(options)
|
data/spec/adapter_spec.rb
CHANGED
@@ -170,5 +170,24 @@ RSpec.describe Carrierwave::Base64::Adapter do
|
|
170
170
|
expect { subject.update!(username: 'new-username') }.not_to raise_error
|
171
171
|
end
|
172
172
|
end
|
173
|
+
|
174
|
+
context 'models with a block for the uploader' do
|
175
|
+
subject do
|
176
|
+
User.mount_base64_uploader(:image, uploader) do
|
177
|
+
def monkey
|
178
|
+
'blah'
|
179
|
+
end
|
180
|
+
end
|
181
|
+
User.new
|
182
|
+
end
|
183
|
+
|
184
|
+
it 'should return an instance of a subclass of CarrierWave::Uploader::Base' do
|
185
|
+
expect(subject.image).to be_a(CarrierWave::Uploader::Base)
|
186
|
+
end
|
187
|
+
|
188
|
+
it 'should apply any custom modifications' do
|
189
|
+
expect(subject.image.monkey).to eq('blah')
|
190
|
+
end
|
191
|
+
end
|
173
192
|
end
|
174
193
|
end
|