Sha256: d315a53758fcd3596a57f0fd3af0dcdd23188bc7f4362ebb3dab4bb04dc03a55

Contents?: true

Size: 457 Bytes

Versions: 1

Compression:

Stored size: 457 Bytes

Contents

# frozen_string_literal: true

module Simpleadmin
  module Decorators
    module Fields
      class Image < Base
        def call
          record = model.find(resource[:id])

          if record.public_send(table_field_name).respond_to?(:url)
            record.public_send(table_field_name).url
          else
            raise TypeError, "The column #{table_field_name} doesn't support image format"
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simpleadmin-1.5.0 lib/simpleadmin/decorators/fields/image.rb