ActiveStorage Service to store files PostgeSQL.
Files are stored in PostgreSQL as Large Objects, which provide streaming style access. More information about Large Objects can be found here.
This allows use of ActiveStorage on hosting platforms with ephemeral file systems such as Heroku without relying on third party storage services.
There are some limits to the storage of Large Objects in PostgerSQL, so this is only recommended for prototyping and very small sites.
Add this line to your application's Gemfile:
gem 'active_storage-postgresql'
And then execute:
$ bundle
In config/storage.yml set PostgreSQL as the service
local:
service: PostgreSQL
Copy over the migrations:
rails active_storage:install
rails active_storage:postgresql:install
Bug reports and pull requests are welcome on GitHub at https://github.com/lsylvester/active_storage-postgresql. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
Special thanks to diogob whos work on carrierwave-postgresql inspired this.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the ActiveStorage::PostgreSQL project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.