Sha256: c8ed79fd2d905c11eefa2f0c88307698a22c83cdee21be2244bb233f4c66693c

Contents?: true

Size: 682 Bytes

Versions: 26

Compression:

Stored size: 682 Bytes

Contents

module Foobara
  class Entity < Model
    module Concerns
      module Types
        include Concern

        module ClassMethods
          def entity_type
            model_type
          end

          def type_declaration(...)
            raise "No primary key set yet" unless primary_key_attribute

            super.merge(type: :entity, primary_key: primary_key_attribute)
          end

          def set_model_type
            if primary_key_attribute
              super
            end
          end

          def primary_key_type
            @primary_key_type ||= attributes_type.element_types[primary_key_attribute]
          end
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
foobara-0.0.26 projects/entity/src/concerns/types.rb
foobara-0.0.25 projects/entity/src/concerns/types.rb
foobara-0.0.24 projects/entity/src/concerns/types.rb
foobara-0.0.23 projects/entity/src/concerns/types.rb
foobara-0.0.22 projects/entity/src/concerns/types.rb
foobara-0.0.21 projects/entity/src/concerns/types.rb
foobara-0.0.20 projects/entity/src/concerns/types.rb
foobara-0.0.19 projects/entity/src/concerns/types.rb
foobara-0.0.18 projects/entity/src/concerns/types.rb
foobara-0.0.17 projects/entity/src/concerns/types.rb
foobara-0.0.16 projects/entity/src/concerns/types.rb
foobara-0.0.15 projects/entity/src/concerns/types.rb
foobara-0.0.14 projects/entity/src/concerns/types.rb
foobara-0.0.13 projects/entity/src/concerns/types.rb
foobara-0.0.12 projects/entity/src/concerns/types.rb
foobara-0.0.11 projects/entity/src/concerns/types.rb
foobara-0.0.10 projects/entity/src/concerns/types.rb
foobara-0.0.9 projects/entity/src/concerns/types.rb
foobara-0.0.8 projects/entity/src/concerns/types.rb
foobara-0.0.7 projects/entity/src/concerns/types.rb