Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActiveStorage decorators #854

Open
mkamensky opened this issue May 8, 2019 · 3 comments
Open

ActiveStorage decorators #854

mkamensky opened this issue May 8, 2019 · 3 comments

Comments

@mkamensky
Copy link

I suggest including support for decorating ActiveStorage attachment. Since ActiveStorage does not derive from ActiveRecord, this is not automatic. I currently do it by putting

Draper.setup_orm(ActiveStorage::Attached)

in a initializer. Thanks!

@Alexander-Senko
Copy link
Collaborator

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.

@mkamensky
Copy link
Author

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.

@Alexander-Senko
Copy link
Collaborator

Alexander-Senko commented Oct 31, 2024

@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:

That's why I'm asking for your use cases. I'd like to consider supporting them in my libs too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants