Module: DelayedPaperclip::InstanceMethods
- Defined in:
- lib/delayed_paperclip.rb
Instance Method Summary collapse
-
#enqueue_delayed_processing ⇒ Object
First mark processing then create.
- #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 create
75 76 77 78 79 80 81 82 |
# File 'lib/delayed_paperclip.rb', line 75 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
84 85 86 |
# File 'lib/delayed_paperclip.rb', line 84 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
65 66 67 68 69 70 71 |
# File 'lib/delayed_paperclip.rb', line 65 def mark_enqueue_delayed_processing unless @_enqued_for_processing_with_processing.blank? # catches nil and empy 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.update_all(updates, "id = #{self.id}") end end |
#prepare_enqueueing_for(name) ⇒ Object
88 89 90 91 92 93 94 95 96 |
# File 'lib/delayed_paperclip.rb', line 88 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 |