class Dsl::Polymorphs::PolymorphValidator
Public Instance Methods
validate_each(record, attribute, data)
click to toggle source
# File lib/dsl/polymorphs.rb, line 11 def validate_each(record, attribute, data) return unless record.try(attribute).try(:id).nil? && record.try("#{attribute}_id".to_sym).nil? && !options[:keys].include?(data['type'].try(:to_sym)) record.errors.add(attribute, 'type must be included in the list') end