lib/delayed/performable_method.rb in delayed_job-4.0.0 vs lib/delayed/performable_method.rb in delayed_job-4.0.1
- old
+ new
@@ -7,11 +7,11 @@
delegate :method, :to => :object
def initialize(object, method_name, args)
raise NoMethodError, "undefined method `#{method_name}' for #{object.inspect}" unless object.respond_to?(method_name, true)
- if object.respond_to?(:new_record?) && object.new_record?
- raise(ArgumentError, 'Jobs cannot be created for records before they\'ve been persisted')
+ if object.respond_to?(:persisted?) && !object.persisted?
+ raise(ArgumentError, 'Jobs cannot be created for non-persisted records')
end
self.object = object
self.args = args
self.method_name = method_name.to_sym