Class: Uchi::Field::HasAndBelongsToMany::Edit

Inherits:
Base::Edit
  • Object
show all
Defined in:
app/components/uchi/field/has_and_belongs_to_many.rb

Instance Attribute Summary

Attributes inherited from Base::Edit

#field, #form, #hint, #label, #record, #repository

Instance Method Summary collapse

Methods inherited from Base::Edit

#initialize

Constructor Details

This class inherits a constructor from Uchi::Field::Base::Edit

Instance Method Details

#collectionObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/components/uchi/field/has_and_belongs_to_many.rb', line 9

def collection
  associated_repository = field.associated_repository(record: record)

  field
    .collection(record: record)
    .map { |associated_record|
      [
        associated_repository.title(associated_record),
        associated_record.id
      ]
    }
end