Module: Foobara::DetachedEntity::Concerns::Types::ClassMethods
- Defined in:
- foobara-0.1.7/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
48 49 50 |
# File 'foobara-0.1.7/projects/detached_entity/src/concerns/types.rb', line 48 def entity_name model_name end |
#entity_type ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'foobara-0.1.7/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
38 39 40 |
# File 'foobara-0.1.7/projects/detached_entity/src/concerns/types.rb', line 38 def @foobara_primary_key_type ||= attributes_type.element_types[primary_key_attribute] end |
#full_entity_name ⇒ Object
44 45 46 |
# File 'foobara-0.1.7/projects/detached_entity/src/concerns/types.rb', line 44 def full_entity_name full_model_name end |
#set_model_type ⇒ Object
32 33 34 35 36 |
# File 'foobara-0.1.7/projects/detached_entity/src/concerns/types.rb', line 32 def set_model_type if primary_key_attribute super end end |
#type_declaration ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'foobara-0.1.7/projects/detached_entity/src/concerns/types.rb', line 20 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 |