-
Notifications
You must be signed in to change notification settings - Fork 21.8k
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 and Mongo #31408
Comments
Active Storage only support Active Record and we have no plans to work in different ORMs support. Of course if you are willing to make Active Storage working with Mongo feel free to send PRs. |
Gotcha thanks @rafaelfranca |
Has this changed at all? I thought ActiveStorage would work with anything that uses ActiveModel, a bit like ActiveJob works with Sidekiq and others. But trying to use it immediately throws an active record migrations exception. Maybe it should be called ActiveRecordStorage as it is currently implemented 🙈 |
No. |
Since some of us may use Rails with the Ruby ODM framework for MongoDB mongoid, I would advise them to use the gems shrine with nextcloud. |
@rafaelfranca Why is Active Storage supporting only Active Record and why don'y you have any plan to work with other ORMs support? Please avoid the "No." answer like @georgeclaghorn which is really useless |
I understand the frustration. However, from what I see, I think none of us are actually use ODM in our companies. Merging code into core comes with a maintenance burden. With us not really "eating our own dog food", I don't think it's a good idea for Active Storage to have ODM support as we probably do not know what we are doing (compared to, say, use job and queue with Resque backend) However, I think we probably are open if anyone want to make a |
That sounds good ! Thank you @sikachu. |
@sikachu said everything. We are happy to have a multi-adapter support for Active Storage but we are not going to do the work for it. If there is interest from a mongoid adapter I'd suggest people to try to implement it with the current API and as soon a new adapter takes traction we can change the framework to make new adapters easier. The reason for that is to avoid building an extension API that nobody will use. |
Thank you @rafaelfranca for the additional details |
Any updates for ActiveStorage and mongoid? |
What would be the best approach to do this? I think I can get my company to support the development of a mongoid adapter for active storage, I'm just not sure which would be the best way to proceed |
@jafuentest In order to do this, one would need to disentangle ActiveStorage from ActiveRecord. If we take for example a look at
and rails/activerecord/lib/active_record/store.rb Line 105 in 914caca
which in turn uses Therefore, Furthermore And then, there are rails/activestorage/lib/active_storage/attached/model.rb Lines 174 to 181 in 914caca
If we can find suitable abstractions and indirections to decouple ActiveStorage from ActiveRecord, the rest seems pretty much a straightforward analogy to ActiveJob's queue adapter system: rails/activejob/lib/active_job/queue_adapters.rb Lines 113 to 141 in 914caca
|
Has anything changed since the last posting on this thread? |
Steps to reproduce
This is a possible feature request. I just installed Rails 5.2.0 beta2 and created a project with the
-O
option because I want to use Mongo instead of a relational database. What I noticed is that ActiveStorage, which I wanted to try out, was also disabled. I just saw that the gem is depending on ActiveRecord exclusively.Expected behavior
Create a project with
-O
but not with--skip-active-storage
and have ActiveStorage available, while ActiveRecord is disabled.Actual behavior
ActiveStorage is not available.
System configuration
Rails version: 5.2.0.beta2
Ruby version: ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin16]
The text was updated successfully, but these errors were encountered: