Sha256: e68f852bb2da79f538277c1de6f7d8053f7175d8109c653ce7eba43c0b7f8421
Contents?: true
Size: 730 Bytes
Versions: 16
Compression:
Stored size: 730 Bytes
Contents
# frozen_string_literal: true module Maglev module ActiveStorage extend ActiveSupport::Concern included do after_commit :save_metadata_now, on: :create has_one_attached :file delegate :url, :download, to: :file end private # rubocop:disable Metrics/AbcSize def save_metadata_now file.analyze if file.attached? update( filename: file.filename.to_s, content_type: file.content_type, byte_size: file.byte_size, height: file.metadata['height'], width: file.metadata['width'] ) end # rubocop:enable Metrics/AbcSize module ClassMethods def optimized all.with_attached_file end end end end
Version data entries
16 entries across 16 versions & 1 rubygems