Class: SDL::Association::BelongsTo
- Inherits:
-
SDL::Association
- Object
- Field
- SDL::Association
- SDL::Association::BelongsTo
- Includes:
- Field::ColumnOptions
- Defined in:
- lib/sdl/association.rb
Overview
Indicates a one-to-one connection with another Model
Instance Method Summary collapse
-
#column_name ⇒ Name
The name of the column.
-
#default ⇒ Object
included
from Field::ColumnOptions
A default value for this field.
-
#foreign_key? ⇒ Boolean
Should this field have a foreign key?.
-
#index? ⇒ Boolean
included
from Field::ColumnOptions
Should this field have an index?.
-
#limit ⇒ Integer
included
from Field::ColumnOptions
A limit for the field.
-
#precision ⇒ Integer
included
from Field::ColumnOptions
A precision for the field.
-
#scale ⇒ Integer
included
from Field::ColumnOptions
A scale for the field.
-
#type ⇒ Symbol
The type of field.
-
#unique? ⇒ Boolean
included
from Field::ColumnOptions
Is this field unique?.
Constructor Details
This class inherits a constructor from SDL::Field
Instance Method Details
#column_name ⇒ Name
The name of the column
61 62 63 |
# File 'lib/sdl/association.rb', line 61 def column_name Name.new("#{name}_id") end |
#default ⇒ Object Originally defined in module Field::ColumnOptions
A default value for this field
#foreign_key? ⇒ Boolean
Should this field have a foreign key?
55 56 57 |
# File 'lib/sdl/association.rb', line 55 def foreign_key? .fetch(:foreign_key, false) end |
#index? ⇒ Boolean Originally defined in module Field::ColumnOptions
Should this field have an index?
#limit ⇒ Integer Originally defined in module Field::ColumnOptions
A limit for the field
#precision ⇒ Integer Originally defined in module Field::ColumnOptions
A precision for the field
#scale ⇒ Integer Originally defined in module Field::ColumnOptions
A scale for the field
#type ⇒ Symbol
The type of field
49 50 51 |
# File 'lib/sdl/association.rb', line 49 def type :belongs_to end |
#unique? ⇒ Boolean Originally defined in module Field::ColumnOptions
Is this field unique?