Permalink
Browse files

It should not be assumed ActiveRecord is loaded when using Mongoid fo…

…r example
  • Loading branch information...
1 parent 1db8109 commit 9ce86440bc5e8fe0cb4f0df2029fc5b7cb210be2 @unnu unnu committed Mar 22, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/delayed/performable_method.rb
@@ -9,7 +9,7 @@ class PerformableMethod
def initialize(object, method_name, args)
raise NoMethodError, "undefined method `#{method_name}' for #{object.inspect}" unless object.respond_to?(method_name, true)
- if object.kind_of?(ActiveRecord::Base)
+ if defined?(ActiveRecord) && object.kind_of?(ActiveRecord::Base)
raise(ArgumentError, 'Jobs cannot be created for records before they\'ve been persisted') if object.attributes[object.class.primary_key].nil?
end

0 comments on commit 9ce8644

Please sign in to comment.