Module: Iry::Constraint Abstract

Defined in:
lib/iry/constraint.rb,
lib/iry/constraint/check.rb,
lib/iry/constraint/unique.rb,
lib/iry/constraint/exclusion.rb,
lib/iry/constraint/foreign_key.rb

Overview

This module is abstract.

Interface representing a constraint. A constraint has a name and can apply errors to an object inheriting from ActiveRecord::Base

Defined Under Namespace

Classes: Check, Exclusion, ForeignKey, Unique

Instance Method Summary collapse

Instance Method Details

#apply(model) ⇒ ActiveModel::Error

This method is abstract.

Sets validation errors on the model

Parameters:

Returns:

  • (ActiveModel::Error)


10
11
# File 'lib/iry/constraint.rb', line 10

def apply(model)
end

#messageSymbol, String

This method is abstract.

Message to be attached as validation error to the model (see Handlers::Model)

Returns:

  • (Symbol, String)


23
24
# File 'lib/iry/constraint.rb', line 23

def message
end

#nameString

This method is abstract.

Name of the constraint to be caught from the database

Returns:

  • (String)


16
17
# File 'lib/iry/constraint.rb', line 16

def name
end