Module: Foobara::DetachedEntity::Concerns::Types::ClassMethods
- Defined in:
- foobara-0.5.8/projects/entities/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
56 57 58 |
# File 'projects/entities/projects/detached_entity/src/concerns/types.rb', line 56 def entity_name model_name end |
#entity_type ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'projects/entities/projects/detached_entity/src/concerns/types.rb', line 18 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
46 47 48 |
# File 'projects/entities/projects/detached_entity/src/concerns/types.rb', line 46 def @foobara_primary_key_type ||= attributes_type.element_types[primary_key_attribute] end |
#full_entity_name ⇒ Object
52 53 54 |
# File 'projects/entities/projects/detached_entity/src/concerns/types.rb', line 52 def full_entity_name full_model_name end |
#set_model_type ⇒ Object
40 41 42 43 44 |
# File 'projects/entities/projects/detached_entity/src/concerns/types.rb', line 40 def set_model_type if primary_key_attribute super end end |
#type_declaration ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'projects/entities/projects/detached_entity/src/concerns/types.rb', line 28 def type_declaration(...) raise "No primary key set yet" unless primary_key_attribute declaration = super declaration[:type] = :detached_entity declaration[:primary_key] = primary_key_attribute declaration.is_absolutified = true declaration end |