rails
rails copied to clipboard
Allow configuration of embeddable storage service for ActionText via `has_rich_text`
Summary
Fixes: https://github.com/rails/rails/issues/45405
Other Information
This is what I came up with. Essentially, it allows specifying attachment_service
when defining has_rich_text
association on a model.
Not sure how to write the tests for it though.
cc @skipkayhil
I found that :unknown
service is tested in Active Storage:
https://github.com/rails/rails/blob/d51b17184932f54d60e2098fccbdcceaa76ba753/activestorage/test/models/attached/many_test.rb#L890-L898
That's not really what we want to be testing but it may work okay? It's also possible that Active Storage itself could use some tests for changing the service per attachment and we can figure out something that would work for both
@skipkayhil I made some updates including tests. Not sure if it's the right way to test it. Probably need to update docs around this if this is accepted. Additionally, when running the tests, the console is screaming with warnings due to redefinitions. Not sure if that is a problem. What do you think?