Class: Gitlab::Reflections::Relationships::Handlers::ActiveStorageHandler

Inherits:
BaseHandler
  • Object
show all
Defined in:
lib/gitlab/reflections/relationships/handlers/active_storage_handler.rb

Overview

Handles Active Storage file attachment associations Examples:

has_many_attached :images
has_one_attached :avatar

Instance Attribute Summary

Attributes inherited from BaseHandler

#association_name, #model, #reflection

Instance Method Summary collapse

Methods inherited from BaseHandler

#build_relationships, #initialize

Constructor Details

This class inherits a constructor from Gitlab::Reflections::Relationships::Handlers::BaseHandler

Instance Method Details

#relationship_attributesObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/gitlab/reflections/relationships/handlers/active_storage_handler.rb', line 12

def relationship_attributes
  super.merge(
    child_table: 'active_storage_attachments',
    foreign_key: 'record_id',
    parent_association: {
      name: association_name.to_s,
      type: reflection.macro.to_s,
      model: model.name
    }
  )
end