Class: Spectifly::Sequel::Field

Inherits:
Base::Field
  • Object
show all
Defined in:
lib/spectifly/sequel/field.rb

Instance Method Summary collapse

Instance Method Details

#for_new_migration(model, entity_references = []) ⇒ Object

The entity_references param is the list of entity namesthat the caller knows about. This lets us figure out whether the field should actually be the id of the entity/model being referenced by the field type.



16
17
18
19
# File 'lib/spectifly/sequel/field.rb', line 16

def for_new_migration(model, entity_references = [])
  @field_for_migration = Spectifly::Sequel::FieldForMigration.new(self, model, entity_references)
  @field_for_migration.render
end

#typeObject



4
5
6
7
8
9
10
11
# File 'lib/spectifly/sequel/field.rb', line 4

def type
  field_type = super
  if base_type = Spectifly::Sequel::Types::Extended[field_type]
    field_type = base_type['Type']
  end

  Spectifly::Support.camelize(field_type)
end