Class: Releaf::Content::Node::SinglenessValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
app/validators/releaf/content/node/singleness_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate(node) ⇒ Object



5
6
7
8
9
# File 'app/validators/releaf/content/node/singleness_validator.rb', line 5

def validate node
  @node = node
  node.errors.add(:content_type, 'node exists') unless node_valid?
  remove_instance_variable(:@node)
end