Skip to content

Commit

Permalink
Added missing 'unscoped' (broken in commit a47e0d7), which is needed …
Browse files Browse the repository at this point in the history
…for delayed_jobs with default-scoped ActiveRecord arguments to function correctly (= as they used to in v.4.0.3). The error message in the rescue block is also broken, but this seems to be fixed in another pull request.
  • Loading branch information
oseiskar committed Nov 3, 2014
1 parent 6d0a6b2 commit 274611a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/delayed/psych_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def visit_Psych_Nodes_Mapping(object) # rubocop:disable CyclomaticComplexity, Me
result = super
if defined?(ActiveRecord::Base) && result.is_a?(ActiveRecord::Base)
begin
result.class.find(result[result.class.primary_key])
result.class.unscoped.find(result[result.class.primary_key])
rescue ActiveRecord::RecordNotFound => error # rubocop:disable BlockNesting
raise Delayed::DeserializationError, "ActiveRecord::RecordNotFound, class: #{klass}, primary key: #{id} (#{error.message})"
end
Expand Down

0 comments on commit 274611a

Please sign in to comment.