Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/delayed/yaml_extensions.rb,
lib/delayed/backend/active_record.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.load_for_delayed_job(id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/delayed/backend/active_record.rb', line 5

def self.load_for_delayed_job(id)
  if id
    find(id)
  else
    super
  end
end

Instance Method Details

#encode_with(coder) ⇒ Object



24
25
26
27
28
# File 'lib/delayed/yaml_extensions.rb', line 24

def encode_with(coder)
  raise("Can't serialize unsaved ActiveRecord object for delayed job: #{inspect}") if id.nil?

  coder.scalar("!ruby/ActiveRecord:#{self.class.name}", id.to_s)
end