Module: EasyTalk::Model::ActiveRecordClassMethods

Defined in:
lib/easy_talk/model.rb

Overview

Module containing ActiveRecord-specific methods for schema generation

Instance Method Summary collapse

Instance Method Details

#active_record_schema_definitionSchemaDefinition

Gets a SchemaDefinition that’s built from the ActiveRecord database schema

Returns:



234
235
236
# File 'lib/easy_talk/model.rb', line 234

def active_record_schema_definition
  @active_record_schema_definition ||= ActiveRecordSchemaBuilder.new(self).build_schema_definition
end

#enhance_schema(enhancements) ⇒ void

This method returns an undefined value.

Enhance the generated schema with additional information

Parameters:

  • enhancements (Hash)

    The schema enhancements



249
250
251
252
253
254
255
# File 'lib/easy_talk/model.rb', line 249

def enhance_schema(enhancements)
  @schema_enhancements = enhancements
  # Clear cached values to force regeneration
  @active_record_schema_definition = nil
  @schema = nil
  @json_schema = nil
end

#schema_enhancementsHash

Store enhancements to be applied to the schema

Returns:

  • (Hash)

    The schema enhancements



241
242
243
# File 'lib/easy_talk/model.rb', line 241

def schema_enhancements
  @schema_enhancements ||= {}
end