Class: Dbee::Model::Constraints::Reference
- Defined in:
- lib/dbee/model/constraints/reference.rb
Overview
A Reference constraint is a constraint between two data models. In DB terms: the name represents the column name on the child and the parent represents the column name on the parent table.
Instance Attribute Summary collapse
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(name:, parent:) ⇒ Reference
constructor
A new instance of Reference.
Methods inherited from Base
Constructor Details
#initialize(name:, parent:) ⇒ Reference
Returns a new instance of Reference.
21 22 23 24 25 26 27 28 |
# File 'lib/dbee/model/constraints/reference.rb', line 21 def initialize(name:, parent:) raise ArgumentError, 'name is required' if name.to_s.empty? raise ArgumentError, 'parent is required' if parent.to_s.empty? super(name: name, parent: parent) freeze end |
Instance Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
19 20 21 |
# File 'lib/dbee/model/constraints/reference.rb', line 19 def parent @parent end |