Skip to content
This repository has been archived by the owner on Oct 5, 2018. It is now read-only.

Commit

Permalink
Allow processing some styles in foreground, some in background
Browse files Browse the repository at this point in the history
Detect when only_process is set but different on has_attached_file and
process_in_background. In which case run foreground styles in normal hook,
and allow the backgrounded job to handle the styles on process_in_background
as normal.
  • Loading branch information
jebw authored and jrgifford committed Jan 20, 2014
1 parent 02d162b commit a898f49
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/delayed_paperclip/attachment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def delayed_options

# Attr accessor in Paperclip
def post_processing_with_delay
!delay_processing?
!delay_processing? || split_processing?
end

def post_processing_with_delay=(value)
Expand All @@ -34,6 +34,12 @@ def delay_processing?
!@post_processing_with_delay
end
end

def split_processing?
@instance.class.paperclip_definitions[@name][:only_process] &&
@instance.class.paperclip_definitions[@name][:only_process] !=
@instance.class.paperclip_definitions[@name][:delayed][:only_process]
end

def processing?
@instance.send(:"#{@name}_processing?")
Expand Down

0 comments on commit a898f49

Please sign in to comment.