lib/delayed_paperclip/attachment.rb in delayed_paperclip-2.4.5.1 vs lib/delayed_paperclip/attachment.rb in delayed_paperclip-2.4.5.2

- old
+ new

@@ -5,11 +5,10 @@ base.send :include, InstanceMethods base.send :attr_accessor, :job_is_processing base.alias_method_chain :post_processing, :delay base.alias_method_chain :post_processing=, :delay base.alias_method_chain :save, :prepare_enqueueing - base.alias_method_chain :most_appropriate_url, :processed base.alias_method_chain :post_process_styles, :processing end module InstanceMethods @@ -43,38 +42,26 @@ self.job_is_processing = false end def post_process_styles_with_processing(*args) post_process_styles_without_processing(*args) - instance.update_attribute("#{name}_processing", false) if instance.respond_to?(:"#{name}_processing?") - # instance.update_column("#{name}_processing", false) if instance.respond_to?(:"#{name}_processing?") - # - # if instance.respond_to?(:"#{name}_processing?") - # instance.send("#{name}_processing=", false) - # instance.class.update_all({ "#{name}_processing" => false }, instance.class.primary_key => instance.id) - # end + # update_column is available in rails 3.1 instead we can do this to update the attribute without callbacks + + #instance.update_column("#{name}_processing", false) if instance.respond_to?(:"#{name}_processing?") + if instance.respond_to?(:"#{name}_processing?") + instance.send("#{name}_processing=", false) + instance.class.update_all({ "#{name}_processing" => false }, instance.class.primary_key => instance.id) + end end def save_with_prepare_enqueueing was_dirty = @dirty save_without_prepare_enqueueing.tap do if delay_processing? && was_dirty instance.prepare_enqueueing_for name end end - end - - def most_appropriate_url_with_processed - if original_filename.nil? || delayed_default_url? - default_url - else - @options.url - end - end - - def delayed_default_url? - !(job_is_processing || dirty? || !delayed_options.try(:[], :url_with_processing) || !(@instance.respond_to?(:"#{name}_processing?") && processing?)) end end end end