Skip to content

Commit

Permalink
Merge c501428 into b8ff983
Browse files Browse the repository at this point in the history
  • Loading branch information
Julie committed Apr 1, 2013
2 parents b8ff983 + c501428 commit a0990e8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/delayed/backend/active_record.rb
Expand Up @@ -9,6 +9,9 @@ class Job < ::ActiveRecord::Base

scope :by_priority, lambda { order('priority ASC, run_at ASC') }

attr_accessible :priority, :run_at, :queue, :payload_object,
:failed_at, :locked_at, :locked_by

before_save :set_default_run_at

def self.set_delayed_job_table_name
Expand Down
15 changes: 15 additions & 0 deletions spec/delayed/backend/active_record_spec.rb
Expand Up @@ -43,6 +43,21 @@
end
end

context "ActiveRecord::Base.send(:attr_accessible, nil)" do
before do
Delayed::Backend::ActiveRecord::Job.send(:attr_accessible, nil)
end

after do
Delayed::Backend::ActiveRecord::Job.send(:attr_accessible, *Delayed::Backend::ActiveRecord::Job.new.attributes.keys)
end

it "is still accessible" do
job = Delayed::Backend::ActiveRecord::Job.enqueue :payload_object => EnqueueJobMod.new
expect(Delayed::Backend::ActiveRecord::Job.find(job.id).handler).to_not be_blank
end
end

context "ActiveRecord::Base.table_name_prefix" do
it "when prefix is not set, use 'delayed_jobs' as table name" do
::ActiveRecord::Base.table_name_prefix = nil
Expand Down

0 comments on commit a0990e8

Please sign in to comment.