Sha256: 71fe439a1430f35ef0b97b532a12d770a2ce927c07a2372182658083683f0905

Contents?: true

Size: 883 Bytes

Versions: 2

Compression:

Stored size: 883 Bytes

Contents

class Lockbox
  class Railtie < Rails::Railtie
    initializer "lockbox" do |app|
      require "lockbox/carrier_wave_extensions" if defined?(CarrierWave)

      if defined?(ActiveStorage)
        require "lockbox/active_storage_extensions"
        ActiveStorage::Attached.prepend(Lockbox::ActiveStorageExtensions::Attached)
        if ActiveStorage::VERSION::MAJOR >= 6
          ActiveStorage::Attached::Changes::CreateOne.prepend(Lockbox::ActiveStorageExtensions::CreateOne)
        end
        ActiveStorage::Attached::One.prepend(Lockbox::ActiveStorageExtensions::AttachedOne)
        ActiveStorage::Attached::Many.prepend(Lockbox::ActiveStorageExtensions::AttachedMany)
      end

      app.config.to_prepare do
        if defined?(ActiveStorage)
          ActiveStorage::Attachment.include(Lockbox::ActiveStorageExtensions::Attachment)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lockbox-0.2.5 lib/lockbox/railtie.rb
lockbox-0.2.4 lib/lockbox/railtie.rb