There is a case we want to use the Active Storage without Rails. We are using activemodel, activejob in Gemfile. we would like to use activestorage in our ruby application.
Is it possible to configure and use activestorage without rails? if so can anyone please give us the suggestion how to configure and use.
Thanks in advance!
Related
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.
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
I am building a rails app without a database.
In Disable ActiveRecord for Rails 4 I learned how to configure the app so that the absence of the database related gems does not interfere with running it. The problem is that I still want to create models using the commend rails generate mode MyModel.
Under this configuration, the above command does nothing at all.
I am assuming here I would need to require some modules (for example, activemodel, which seems to provide ActiveRecord-like capabilities without necessarily having a DB) in application.rb, but I can seem to find which.
Could someone help?
Thanks in advance
You can take a look at How to create custom generators for my rails app.
Basically you will have to change the behavior of your model generators. This way you can tell which file will be created, with which code template and etc.
Is it possible to use the delayed_job gem outside of Rails? Or put another way, can it be used in a pure Ruby project?
If so, how?
I don't know why this person never posted this.
It's easy. Two steps:
http://brkrd.com/post/45269754283/delayed-job-without-rails
UPDATE Looks like the link is broken.
You will need Active Record, but not Rails. You will have to mock a Rails object, and load your database information, environment, and root into the Rails object so that DelayedJob thinks it's in the Rails environment.
Delayed Job looks heavily rails dependent. https://github.com/defunkt/resque resque is a very good gem that is not rails dependent that accomplishes the same goal. You do however have to have redis on your machine which is very lightweight. Resque also has a cool Sinatra web console to see what is going on.