lib/delayed_paperclip/attachment.rb in delayed_paperclip-2.6.0.0 vs lib/delayed_paperclip/attachment.rb in delayed_paperclip-2.6.1

- old
+ new

@@ -10,27 +10,30 @@ base.alias_method_chain :after_flush_writes, :processing end module InstanceMethods + def delayed_options + @instance.class.paperclip_definitions[@name][:delayed] + end + + # Attr accessor in Paperclip def post_processing_with_delay !delay_processing? end def post_processing_with_delay=(value) @post_processing_with_delay = value end - def delayed_options - @instance.class.attachment_definitions[@name][:delayed] - end - + # if nil, returns whether it has delayed options + # if set, then it returns def delay_processing? if @post_processing_with_delay.nil? !!delayed_options else - !@post_processing_with_delay + !@post_processing_with_delay end end def processing? @instance.send(:"#{@name}_processing?") @@ -47,13 +50,12 @@ processing_image_url = @options[:delayed][:processing_image_url] processing_image_url = processing_image_url.call(self) if processing_image_url.respond_to?(:call) processing_image_url end - + # Updates _processing column to false def after_flush_writes_with_processing(*args) after_flush_writes_without_processing(*args) - # 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)