rails icon indicating copy to clipboard operation
rails copied to clipboard

Allow configuration of embeddable storage service for ActionText via `has_rich_text`

Open mihaic195 opened this issue 1 year ago • 2 comments

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

mihaic195 avatar Jun 24 '22 14:06 mihaic195

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 avatar Jun 24 '22 14:06 skipkayhil

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

mihaic195 avatar Jun 28 '22 20:06 mihaic195