Adding active_storage to a Rails6 app with Mongoid?

Viewed 414

I wanted to replace Carrierwave with ActiveStorage in a Rails 6 app that uses Mongoid as storage (and carrierwave-mongoid) but looks like this storage needs an existing Active Record setup. The rails active_storage:install tasks fails. I tried a mongo AR gem adapter with no luck. Is it possible to workaround it? AFAICS it needs to create 2 new tables with some attachments metadata.

1 Answers

Mongoid does not include any code that is related to ActiveStorage.

Assuming ActiveStorage requires a storage backend (like ActiveRecord), and furthermore if ActiveStorage assumes the application it is in uses ActiveRecord (which isn't the case for applications using Mongoid), you would need to investigate what exactly is required for AS+Mongoid integration and perform that work.

See also https://jira.mongodb.org/browse/MONGOID-4623 where this was requested.

Related