Sha256: 993ffb9e44e4c958c66a0c678dbdc0e91fc23766601ab9f109a7dfe54e5c6b9d
Contents?: true
Size: 781 Bytes
Versions: 2
Compression:
Stored size: 781 Bytes
Contents
# frozen_string_literal: true module Decidim module ReportingProposals # Exposes the proposal resource so users can view and create them. module ComponentValidatorOverride extend ActiveSupport::Concern included do # The actual validator method. It is called when ActiveRecord iterates # over all the validators. def validate_each(record, attribute, component) unless component record.errors[attribute] << :blank return end manifests = [options[:manifest].to_s] manifests << "reporting_proposals" if manifests.first == "proposals" record.errors[attribute] << :invalid unless component.manifest_name.to_s.in?(manifests) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems