Sha256: f46ad126802718d4cf1ce8e37bac20841946a59a04bd54501d636221bdb094a5

Contents?: true

Size: 636 Bytes

Versions: 38

Compression:

Stored size: 636 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("carrierwave.errors.not_inside_organization")
  end

  def check_validity!; end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
decidim-core-0.28.4 app/validators/organization_present_validator.rb
decidim-core-0.27.9 app/validators/organization_present_validator.rb
decidim-core-0.28.3 app/validators/organization_present_validator.rb
decidim-core-0.27.8 app/validators/organization_present_validator.rb
decidim-core-0.28.2 app/validators/organization_present_validator.rb
decidim-core-0.27.7 app/validators/organization_present_validator.rb
decidim-core-0.28.1 app/validators/organization_present_validator.rb
decidim-core-0.27.6 app/validators/organization_present_validator.rb
decidim-core-0.26.10 app/validators/organization_present_validator.rb
decidim-core-0.26.9 app/validators/organization_present_validator.rb
decidim-core-0.28.0 app/validators/organization_present_validator.rb
decidim-core-0.27.5 app/validators/organization_present_validator.rb
decidim-core-0.28.0.rc5 app/validators/organization_present_validator.rb
decidim-core-0.28.0.rc4 app/validators/organization_present_validator.rb
decidim-core-0.26.8 app/validators/organization_present_validator.rb
decidim-core-0.27.4 app/validators/organization_present_validator.rb
decidim-core-0.27.3 app/validators/organization_present_validator.rb
decidim-core-0.26.7 app/validators/organization_present_validator.rb
decidim-core-0.26.5 app/validators/organization_present_validator.rb
decidim-core-0.27.2 app/validators/organization_present_validator.rb