Sha256: 855c730e5d410a0fd665a4e9e3419aebe91e092becd33eec5a24cbdd3052c444

Contents?: true

Size: 440 Bytes

Versions: 25

Compression:

Stored size: 440 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Attributes
    # Custom attributes value to make conversion from signed id (String) to ActiveStorage::Blob easier.
    class Blob < ActiveModel::Type::Value
      def type
        :"decidim/attributes/blob"
      end

      private

      def cast_value(value)
        return value unless value.is_a?(String)

        ActiveStorage::Blob.find_signed(value)
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
decidim-core-0.29.1 lib/decidim/attributes/blob.rb
decidim-core-0.28.4 lib/decidim/attributes/blob.rb
decidim-core-0.27.9 lib/decidim/attributes/blob.rb
decidim-core-0.29.0 lib/decidim/attributes/blob.rb
decidim-core-0.28.3 lib/decidim/attributes/blob.rb
decidim-core-0.27.8 lib/decidim/attributes/blob.rb
decidim-core-0.29.0.rc4 lib/decidim/attributes/blob.rb
decidim-core-0.29.0.rc3 lib/decidim/attributes/blob.rb
decidim-core-0.29.0.rc2 lib/decidim/attributes/blob.rb
decidim-core-0.29.0.rc1 lib/decidim/attributes/blob.rb
decidim-core-0.28.2 lib/decidim/attributes/blob.rb
decidim-core-0.27.7 lib/decidim/attributes/blob.rb
decidim-core-0.28.1 lib/decidim/attributes/blob.rb
decidim-core-0.27.6 lib/decidim/attributes/blob.rb
decidim-core-0.28.0 lib/decidim/attributes/blob.rb
decidim-core-0.27.5 lib/decidim/attributes/blob.rb
decidim-core-0.28.0.rc5 lib/decidim/attributes/blob.rb
decidim-core-0.28.0.rc4 lib/decidim/attributes/blob.rb
decidim-core-0.27.4 lib/decidim/attributes/blob.rb
decidim-core-0.27.3 lib/decidim/attributes/blob.rb