lib/paperclip/globalize3/attachment.rb in paperclip-globalize3-1.0.0 vs lib/paperclip/globalize3/attachment.rb in paperclip-globalize3-1.1.0

- old
+ new

@@ -14,10 +14,11 @@ def assign_with_globalize3(uploaded_file) ensure_required_accessors! file = Paperclip.io_adapters.for(uploaded_file) + return nil if file.respond_to?(:assignment?) && !file.assignment? self.clear(*only_process, :locales => Globalize.locale) # [paperclip-globalize3] only clear current locale return nil if file.nil? @queued_for_write[:original] = file instance_write(:file_name, cleanup_filename(file.original_filename)) @@ -28,12 +29,11 @@ instance_write(:updated_at, Time.now) @dirty = true if post_processing && - (Paperclip::Attachment.instance_method(:valid_assignment?).parameters.present? || # paperclip <=3.3 compatibility - valid_assignment?) + (file.respond_to?(:assignment?) || valid_assignment?) post_process(*only_process) end instance_write(:file_size, @queued_for_write[:original].size) instance_write(:fingerprint, @queued_for_write[:original].fingerprint) if instance_respond_to?(:fingerprint) @@ -77,22 +77,9 @@ # TODO translated_locales are not present any more when this is called via destroy callback (unless 'translates' is defined AFTER 'has_attached_file' in the model class) with_locales = instance.translated_locales if with_locales.nil? Globalize.with_locales([*with_locales]) { yield } else yield - end - end - - end - - module Compatibility - - # For compatibility with paperclip 3.3 - module Paperclip33 - def only_process - only_process = @options[:only_process].dup - only_process = only_process.call(self) if only_process.respond_to?(:call) - only_process.map(&:to_sym) end end end