Open mkamensky opened 5 years ago
Thanks for the suggestion!
It would be highly appreciated if you provided some examples and use cases that demonstrate this as a generic feature a regular app could benefit of.
Thanks for the suggestion!
It would be highly appreciated if you provided some examples and use cases that demonstrate this as a generic feature a regular app could benefit of.
Sorry for the delay. I use it, for example, to generate various html snippets (for instance image tags in active_storage/blob_decorator.rb
), to set to_partial_path
, to return its url, etc.
@mkamensky, thanks for the reply.
While your solution works technically, I'd like to be sure the implemented pattern is quite generic to be supported out of the box.
Could you please provide close to real life usage examples for decorated objects? One thing of a particular interest for me is the rendering context: are they rendered in views or some other places?
Unfortunately, Draper is hard to develop now due to lack of maintainers needed to review the changes. I tried to fix as many things as possible without a major refactoring then. Meanwhile, I consider Draper to be bloated with legacy stuff and cumbersome solutions that make it hard to develop while maintaining backward compatibility.
I was considering a refactoring of Draper for the next major release, but then I developed 3 gems to replace it:
SimpleDelegator
from the standard library, andThat's why I'm asking for your use cases. I'd like to consider supporting them in my libs too.
I suggest including support for decorating
ActiveStorage
attachment. SinceActiveStorage
does not derive fromActiveRecord
, this is not automatic. I currently do it by puttingin a initializer. Thanks!