Alexander Presber
Alexander Presber

Reputation: 6635

Provide class to be decorated by Draper

In pre 1.0 versions of the draper gem we were able to use the decorates method explicitly specifying the class to be decorated (e.g. when the class is namespaced):

MyClassDecorator < Draper::Base
   decorates :my_class, :class => Namespace::MyClass
   ...

Now (draper 1.3) decorates does not accept additional parameters. But just omitting the :class option leads to "uninitialized constant MyClass".

How do we decorate classes whose class names cannot be deducted by draper automatically?

Upvotes: 3

Views: 1544

Answers (1)

Alexander Presber
Alexander Presber

Reputation: 6635

Found the answer here: https://github.com/drapergem/draper/issues/587

It is possible to specify the class instead of a symbol:

MyClassDecorator < Draper::Base
  decorates Namespace::MyClass
  ...

Upvotes: 6

Related Questions