Sha256: afec18610632b77d4e579905df680eda6b684ef5b4c7ca4ced55cbc53e943840
Contents?: true
Size: 745 Bytes
Versions: 9
Compression:
Stored size: 745 Bytes
Contents
# frozen_string_literal: true module Maglev module ActiveStorage extend ActiveSupport::Concern included do has_one_attached :file after_commit :save_metadata_now, on: :create, prepend: true 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
9 entries across 9 versions & 1 rubygems