lib/paperclip/globalize3/attachment.rb in paperclip-globalize3-3.3.0 vs lib/paperclip/globalize3/attachment.rb in paperclip-globalize3-4.0.0

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + module Paperclip module Globalize3 # Prepend to the paperclip `Attachment` class to transparently read and write # your attachments in context of the current locale using globalize. # @@ -8,16 +10,11 @@ # # Requires a :locale interpolation for your paperclip attachment(s) and the # respective columns to be translated. module Attachment def assign(uploaded_file) - @file = - if Paperclip::Attachment.default_options.key?(:adapter_options) # paperclip >= 5.2.0 - Paperclip.io_adapters.for(uploaded_file, @options[:adapter_options]) - else # paperclip < 5.2.0 - Paperclip.io_adapters.for(uploaded_file) - end + @file = Paperclip.io_adapters.for(uploaded_file, @options[:adapter_options]) ensure_required_accessors! ensure_required_validations! if @file.assignment? clear(*only_process, locales: Globalize.locale) # [paperclip-globalize3] only clear current locale @@ -55,10 +52,10 @@ def queue_some_for_delete(*args) options = args.extract_options! styles = args with_locales_if_translated(options[:locales]) do - super(styles) + super(*styles) end end # Yields the given block in context of Globalize#with_locales, but handles these situations gracefully: #