Module: DelayedPaperclip::InstanceMethods
- Defined in:
- lib/delayed_paperclip.rb
Instance Method Summary collapse
-
#enqueue_delayed_processing ⇒ Object
First mark processing then enqueue.
- #enqueue_post_processing_for(name) ⇒ Object
-
#mark_enqueue_delayed_processing ⇒ Object
setting each inididual NAME_processing to true, skipping the ActiveModel dirty setter Then immediately push the state to the database.
- #prepare_enqueueing_for(name) ⇒ Object
Instance Method Details
#enqueue_delayed_processing ⇒ Object
First mark processing then enqueue
89 90 91 92 93 94 95 96 97 |
# File 'lib/delayed_paperclip.rb', line 89 def enqueue_delayed_processing mark_enqueue_delayed_processing (@_enqued_for_processing || []).each do |name| enqueue_post_processing_for(name) end @_enqued_for_processing_with_processing = [] @_enqued_for_processing = [] end |
#enqueue_post_processing_for(name) ⇒ Object
109 110 111 |
# File 'lib/delayed_paperclip.rb', line 109 def enqueue_post_processing_for name DelayedPaperclip.enqueue(self.class.name, read_attribute(:id), name.to_sym) end |
#mark_enqueue_delayed_processing ⇒ Object
setting each inididual NAME_processing to true, skipping the ActiveModel dirty setter Then immediately push the state to the database
101 102 103 104 105 106 107 |
# File 'lib/delayed_paperclip.rb', line 101 def mark_enqueue_delayed_processing unless @_enqued_for_processing_with_processing.blank? # catches nil and empty arrays updates = @_enqued_for_processing_with_processing.collect{|n| "#{n}_processing = :true" }.join(", ") updates = ActiveRecord::Base.send(:sanitize_sql_array, [updates, {:true => true}]) self.class.where(:id => self.id).update_all(updates) end end |
#prepare_enqueueing_for(name) ⇒ Object
113 114 115 116 117 118 119 120 121 122 |
# File 'lib/delayed_paperclip.rb', line 113 def prepare_enqueueing_for name if self.attributes.has_key? "#{name}_processing" write_attribute("#{name}_processing", true) @_enqued_for_processing_with_processing ||= [] @_enqued_for_processing_with_processing << name end @_enqued_for_processing ||= [] @_enqued_for_processing << name end |