Class: Noodall::Node::SlotValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/noodall/node.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



468
469
470
471
472
# File 'lib/noodall/node.rb', line 468

def validate_each(record, attribute, value)
  unless value.nil? or Noodall::Component.positions_classes(options[:slot_type]).one?{|c| c.name == value._type }
    record.errors[attribute] << "cannnot contain a #{value.class.name.humanize} component"
  end
end