Module: Foobara::DetachedEntity::Concerns::Types::ClassMethods
- Defined in:
- foobara-0.0.110/projects/detached_entity/src/concerns/types.rb
Instance Method Summary collapse
- #entity_name ⇒ Object
- #entity_type ⇒ Object
- #foobara_primary_key_type ⇒ Object (also: #primary_key_type)
- #full_entity_name ⇒ Object
- #set_model_type ⇒ Object
- #type_declaration ⇒ Object
Instance Method Details
#entity_name ⇒ Object
42 43 44 |
# File 'foobara-0.0.110/projects/detached_entity/src/concerns/types.rb', line 42 def entity_name model_name end |
#entity_type ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'foobara-0.0.110/projects/detached_entity/src/concerns/types.rb', line 10 def entity_type return @model_type if defined?(@model_type) if attributes_type set_model_type end @model_type end |
#foobara_primary_key_type ⇒ Object Also known as: primary_key_type
32 33 34 |
# File 'foobara-0.0.110/projects/detached_entity/src/concerns/types.rb', line 32 def @foobara_primary_key_type ||= attributes_type.element_types[primary_key_attribute] end |
#full_entity_name ⇒ Object
38 39 40 |
# File 'foobara-0.0.110/projects/detached_entity/src/concerns/types.rb', line 38 def full_entity_name full_model_name end |
#set_model_type ⇒ Object
26 27 28 29 30 |
# File 'foobara-0.0.110/projects/detached_entity/src/concerns/types.rb', line 26 def set_model_type if primary_key_attribute super end end |
#type_declaration ⇒ Object
20 21 22 23 24 |
# File 'foobara-0.0.110/projects/detached_entity/src/concerns/types.rb', line 20 def type_declaration(...) raise "No primary key set yet" unless primary_key_attribute super.merge(type: :detached_entity, primary_key: primary_key_attribute) end |