draper icon indicating copy to clipboard operation
draper copied to clipboard

Rails - STI bug for ActiveRecord_Relation, works fine for a single record

Open james-em opened this issue 2 years ago • 0 comments

Simple explanation of the bug

MyModelBase.all.decorate
=> Could not infer a decorator for MyModelBase. (Draper::UninferrableDecoratorError)

MyModelBase.all.first.decorate
=> #<MyModelSpecificDecorator:0x000000012116d470

Workaround PS: Can cause some performance drawbacks in some cases

MyModelBase.all.map(&:decorate)

Expected behavior

MyModelBase.all.decorate shouldn't raise an error.

james-em avatar May 26 '23 13:05 james-em