Skip to content
This repository has been archived by the owner on Jan 24, 2019. It is now read-only.

Commit

Permalink
Merge pull request jstorimer#58 from csaura/add-unscoped
Browse files Browse the repository at this point in the history
Fix process jobs for models with default_scope
  • Loading branch information
ScotterC committed Oct 3, 2013
2 parents 4c65be3 + 5ddbc13 commit a13b4cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/delayed_paperclip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def enqueue(instance_klass, instance_id, attachment_name)
end

def process_job(instance_klass, instance_id, attachment_name)
instance_klass.constantize.find(instance_id).
instance_klass.constantize.unscoped.find(instance_id).
send(attachment_name).
process_delayed!
end
Expand Down
4 changes: 3 additions & 1 deletion spec/delayed_paperclip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
let(:dummy) { Dummy.create! }

it "finds dummy and calls #process_delayed!" do
Dummy.expects(:find).with(dummy.id).returns(dummy)
dummy_stub = stub
dummy_stub.expects(:find).with(dummy.id).returns(dummy)
Dummy.expects(:unscoped).returns(dummy_stub)
dummy.image.expects(:process_delayed!)
DelayedPaperclip.process_job("Dummy", dummy.id, :image)
end
Expand Down

0 comments on commit a13b4cb

Please sign in to comment.