Class: Spectifly::Sequel::Relationship::OneToOne
- Defined in:
- lib/spectifly/sequel/relationship/one_to_one.rb
Instance Attribute Summary collapse
-
#field_name ⇒ Object
Returns the value of attribute field_name.
-
#required ⇒ Object
Returns the value of attribute required.
-
#table_name ⇒ Object
Returns the value of attribute table_name.
-
#unique ⇒ Object
Returns the value of attribute unique.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(name, attributes, related_entity) ⇒ OneToOne
constructor
A new instance of OneToOne.
Constructor Details
#initialize(name, attributes, related_entity) ⇒ OneToOne
Returns a new instance of OneToOne.
7 8 9 10 11 12 13 |
# File 'lib/spectifly/sequel/relationship/one_to_one.rb', line 7 def initialize(name, attributes, ) super @table_name = Spectifly::Support.tokenize(ActiveSupport::Inflector.pluralize(@entity.type)) @field_name = Spectifly::Support.tokenize(@entity.name) + '_id' @required = @entity.required? @unique = @entity.unique? end |
Instance Attribute Details
#field_name ⇒ Object
Returns the value of attribute field_name.
5 6 7 |
# File 'lib/spectifly/sequel/relationship/one_to_one.rb', line 5 def field_name @field_name end |
#required ⇒ Object
Returns the value of attribute required.
5 6 7 |
# File 'lib/spectifly/sequel/relationship/one_to_one.rb', line 5 def required @required end |
#table_name ⇒ Object
Returns the value of attribute table_name.
5 6 7 |
# File 'lib/spectifly/sequel/relationship/one_to_one.rb', line 5 def table_name @table_name end |
#unique ⇒ Object
Returns the value of attribute unique.
5 6 7 |
# File 'lib/spectifly/sequel/relationship/one_to_one.rb', line 5 def unique @unique end |