Sha256: 9aa1b6474de8ebdb24495f80bd7fbc0260b2568745144fd9a58a80506895498b
Contents?: true
Size: 638 Bytes
Versions: 9
Compression:
Stored size: 638 Bytes
Contents
# frozen_string_literal: true # Validates that the associated record is always within an organization in # order to pass the organization specific settings for the file upload # checks (e.g. file extension, mime type, etc.). class OrganizationPresentValidator < ActiveModel::Validations::FileContentTypeValidator def validate_each(record, attribute, _value) return if record.is_a?(Decidim::Organization) return if record.respond_to?(:organization) && record.organization.is_a?(Decidim::Organization) record.errors.add attribute, I18n.t("decidim.errors.files.not_inside_organization") end def check_validity!; end end
Version data entries
9 entries across 9 versions & 1 rubygems