Skip to content

Commit

Permalink
Fix belongs_to with belongs_to_required_by_default (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
kphelps authored Jan 28, 2021
1 parent b72f966 commit a069aee
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Changelog

### 0.6.1
* Fix job_group_id `belongs_to` behavior when `config.active_record.belongs_to_required_by_default` is enabled.

### 0.6.0
* A support for Rails 6.1.
* Add support for Rails 6.1.

### 0.5.0
* Drop support for Ruby 2.3 and 2.4.
Expand Down
2 changes: 1 addition & 1 deletion lib/delayed/job_groups/job_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def ready_to_run(worker_name, max_run_time)
attr_accessible :job_group_id, :blocked
end

belongs_to :job_group, class_name: 'Delayed::JobGroups::JobGroup'
belongs_to :job_group, class_name: 'Delayed::JobGroups::JobGroup', required: false

class << self
prepend ReadyToRunExtension
Expand Down
2 changes: 1 addition & 1 deletion lib/delayed/job_groups/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Delayed
module JobGroups
VERSION = '0.6.0'
VERSION = '0.6.1'
end
end
9 changes: 9 additions & 0 deletions spec/delayed/job_groups/job_extensions_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

describe "delayed job extensions" do
it "provides an optional job_group_id" do
job_group = Delayed::JobGroups::JobGroup.create!
expect(Delayed::Job.new(job_group_id: job_group.id)).to be_valid
expect(Delayed::Job.new).to be_valid
end
end

0 comments on commit a069aee

Please sign in to comment.