rootstrap / active-storage-base64

Base64 support for ActiveStorage
https://rootstrap.com
MIT License
160 stars 16 forks source link

Working in engines #52

Closed ThiagoCasao closed 4 years ago

ThiagoCasao commented 4 years ago

Greetings.

I have an engine named "Admin" with a model that includes an attribute avatar like bellow: class Person < ApplicationRecord has_one_base64_attached :avatar

So following docs, I set: module Admin class ApplicationRecord < ActiveRecord::Base include ActiveStorageSupport::SupportForBase64

But if I run any command inside the engine, such as rails g migration or whatever other rails command, they failed with the following message: uninitialized constant Admin::ApplicationRecord::ActiveStorageSupport). Please require the necessary files (RequireAll::LoadError)

I have set ApplicationRecord inside App that uses the engine and everything is ok. The error only occurs inside the engine.

I tried require 'active_storage_base64' in top o ApplicationRecord, but doesn't work.

Thank you for your attention.

santib commented 4 years ago

Hi @ThiagoCasao . A couple questions:

ThiagoCasao commented 4 years ago

Hi @santib

Following your instructions, I set the include as you mentionated and I could be able to solve as bellow: include ::ActiveStorageSupport::SupportForBase64 However, I had to set require 'active_storage_base64' in ApplicationRecord and in the model class.

Thank you!