lib/draper/decoratable.rb in draper-3.0.0.pre1 vs lib/draper/decoratable.rb in draper-3.0.0
- old
+ new
@@ -72,22 +72,22 @@
def decorator_class
prefix = respond_to?(:model_name) ? model_name : name
decorator_name = "#{prefix}Decorator"
decorator_name.constantize
rescue NameError => error
+ raise unless error.missing_name?(decorator_name)
if superclass.respond_to?(:decorator_class)
superclass.decorator_class
else
- raise unless error.missing_name?(decorator_name)
raise Draper::UninferrableDecoratorError.new(self)
end
end
# Compares with possibly-decorated objects.
#
# @return [Boolean]
def ===(other)
- super || (other.respond_to?(:object) && super(other.object))
+ super || (other.is_a?(Draper::Decorator) && super(other.object))
end
end
end