Sha256: 3ecef48edca0eac1ddff76a693b0b55aa72c6c064b915391b9dc9d86c0b345e9

Contents?: true

Size: 884 Bytes

Versions: 6

Compression:

Stored size: 884 Bytes

Contents

module 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

6 entries across 6 versions & 1 rubygems

Version Path
lockbox-0.3.5 lib/lockbox/railtie.rb
lockbox-0.3.4 lib/lockbox/railtie.rb
lockbox-0.3.3 lib/lockbox/railtie.rb
lockbox-0.3.2 lib/lockbox/railtie.rb
lockbox-0.3.1 lib/lockbox/railtie.rb
lockbox-0.3.0 lib/lockbox/railtie.rb