lib/draper/decoratable.rb in draper-1.3.0 vs lib/draper/decoratable.rb in draper-1.3.1
- old
+ new
@@ -73,11 +73,15 @@
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)
- raise Draper::UninferrableDecoratorError.new(self)
+ 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]