instance method content_type=

Ruby on Rails 7.0.10

Since v7.0.10 Last seen in v7.0.10

Signature

content_type=(value)

No documentation comment.

Parameters

value req
Source
# File activestorage/app/models/active_storage/blob.rb, line 337
  def content_type=(value)
    unless ActiveStorage.silence_invalid_content_types_warning
      if INVALID_VARIABLE_CONTENT_TYPES_DEPRECATED_IN_RAILS_7.include?(value)
        ActiveSupport::Deprecation.warn(<<-MSG.squish)
          #{value} is not a valid content type, it should not be used when creating a blob, and support for it will be removed in Rails 7.1.
          If you want to keep supporting this content type past Rails 7.1, add it to `config.active_storage.variable_content_types`.
          Dismiss this warning by setting `config.active_storage.silence_invalid_content_types_warning = true`.
        MSG
      end

      if INVALID_VARIABLE_CONTENT_TYPES_TO_SERVE_AS_BINARY_DEPRECATED_IN_RAILS_7.include?(value)
        ActiveSupport::Deprecation.warn(<<-MSG.squish)
          #{value} is not a valid content type, it should not be used when creating a blob, and support for it will be removed in Rails 7.1.
          If you want to keep supporting this content type past Rails 7.1, add it to `config.active_storage.content_types_to_serve_as_binary`.
          Dismiss this warning by setting `config.active_storage.silence_invalid_content_types_warning = true`.
        MSG
      end
    end

    super
  end

Defined in activestorage/app/models/active_storage/blob.rb line 337 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveStorage::Blob

Type at least 2 characters to search.

↑↓ navigate · open · esc close