I am starting an blog with mongoid and I would like to use trix editor along with all facilities of action_text. Is it possible?
Mongoid cannot be used with ActionText due to its reliance on ActiveStorage, which does not support Mongoid (see https://github.com/rails/rails/issues/31408).
Requests have been made to remove the dependency on ActiveRecord from ActiveStorage (https://github.com/rails/rails/issues/42901) however this is not something Rails core is looking to do.
Related
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.
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.
Is it possible to add ActiveStorage on rails 6 without adding ActiveRecord
I am using API application having only mongoDB database. Now, as I have observed that FSGrid which actually a good option, having a database size issue and we want physical file available on S3.
Sadly, it's still not possible now in April 2020.
From Mongodb Docs:
At this time ActiveStorage requires ActiveRecord and is not usable with Mongoid.
They are not working on it and suggest people to try to implement it with the current API as discussed here
Its a code snippet from act_as_audited plugin 1.1.1 under rails/init.rb
Why is this code used? Any general explanation of it is welcomed.
if defined?(ActionController) and defined?(ActionController::Base)
acts_as_audited is intended to be usable with plain ActiveRecord. As you can use ActiveRecord outside of Rails, e.g. in a Sinatra app, it is helpful if a gem doesn't tie itself to Rails.
This is exactly what is happening here: the authors try to detect if they are running under Rails (or more specifically, if the app uses ActionController for routing which is part of Rails) to load additional Rails-specific functionality.
For apps not using ActionController (or Rails), the gem is thus still usable.
It seems that they have dropped this compatibility layer in later releases. This, the successor of acts_as_audited (called just audited) depends on Rails now.
I have a Sinatra app and I want to use RailsAdmin as my admin engine with models in Sinatra app. How can I do that without having to duplicate the model code for RailsAdmin project
I don't think it can be easily done.
rails_admin relies on models being backed by ActiveModel, so you cannot feed it with your plain-ruby models.
You can try someting like this though https://github.com/ratnakarrao-nyros/sinatra-admin, but it doesn't look that well maintained.
MongoDB has two popular ORMs for Rails: MongoID and MongoMapper.
Are there CouchDB ORM:s for Rails 3?
I can't say for sure since I've never used it, but it looks like CouchRest would be the way to go - specifically "CouchRest Model" looks like has been updated to work with Rails3 ActiveModel.
FWIW, I landed on CouchRest after finding this thread.
there is couchRest as noted above, or if you like active record style try couch_foo. I had different needs when i was looking into couch this past spring, and using rails 3. Rails 3 should be ORM agnostic, so it shouldn't really mess with it, although I couldn't get testing to work easily, but that could have just been me.