{"repo":"rootstrap/active-storage-base64","free":true,"listed":false,"github":"https://github.com/rootstrap/active-storage-base64","clone":"git clone https://github.com/rootstrap/active-storage-base64.git","description":"Base64 support for ActiveStorage","language":"Ruby","stars":164,"topics":["ruby","rails","ruby-on-rails","activestorage","rails-api","api","hacktoberfest"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"ActiveStorageBase64 Adds support for base64 attachments to ActiveStorage. Installation In order to get the gem working on your project you just need to add the gem to your project like this: Compatibility Rails Version ActiveStorageBase64 Version -------------- ----------------------------- 8.1.x 3.0.x 8.0.x 3.0.x 7.2.x 3.0.x 7.1.x 3.0.x 7.0.x 2.0.x 6.1.x 1.2.x 6.0.x 1.1.x 5.2.x 0.1.x Prerequisites The only prerequisite for using this gem is having ActiveStorage properly set up in your project. For more information on how to do this, check Active Storage Overview. Usage In order to use the gem's functionality, you need to include the ActiveStorageSupport::SupportForBase64 module in your ActiveRecord models. For example: Note: We highly recommend using an alternative class that inherits from ActiveRecord::Base and includes the module so instead of including the module for each of your classes, you make them inherit from this new class, check below: After you have the module included in your class you'll be able to use the following two helper methods to work with base64 files: When you need a single image attached: and when you need multiple files attached: These helpers will work just like the has one attached and has many attached helper methods from ActiveStorage. A working example for this, assuming we have a model User with an avatar attached would be: on your controller you could do any of the following: Specifying a filename or content type If you are willing to add a s","default_branch":null,"files":null,"tree":[],"storefront":"/r/rootstrap","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/rootstrap/active-storage-base64/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}