You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use drapper to decorates models in the context of my app and its admin interface.
Say for a model class Document i have 2 different decorators DocumentDecorator and Admin::DocumentDecorator.
On the other hand i heavily use STI. Currently decorates_association handle STI pretty well but not when you have more than one decorator per STI class.
Would be nice to have a :module option to decorates_association, eventually settable at the decorator class level for all associations, in order to handle STI associations more nicely :
I can see the use case you are after. The inference this gem is currently doing causes quite a bit of headaches, so I'm hesitant to add more magic. However, I feel like we can do a better job of handling this case. It seems like it should be possible to infer the module without the addition of a module option. In your example above, we could potentially infer the Admin module because the UserDecorator is under the Admin namespace.
I'd be happy to entertain a pull request if you are interested in submitting one.
Hello,
I use drapper to decorates models in the context of my app and its admin interface.
Say for a model class Document i have 2 different decorators
DocumentDecorator
andAdmin::DocumentDecorator
.On the other hand i heavily use STI. Currently
decorates_association
handle STI pretty well but not when you have more than one decorator per STI class.Would be nice to have a :module option to decorates_association, eventually settable at the decorator class level for all associations, in order to handle STI associations more nicely :
I could try to send you a pull request if you find the feature interesting let me know, thx for this nice gem.
EDIT : prefixed example instance variables with 'admin_'
The text was updated successfully, but these errors were encountered: