Class: Uchi::Field::HasAndBelongsToMany::Show

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

Instance Attribute Summary

Attributes inherited from Base::Show

#field, #record, #repository

Instance Method Summary collapse

Methods inherited from Base::Show

#initialize

Constructor Details

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

Instance Method Details

#associated_recordsObject



27
28
29
30
31
# File 'app/components/uchi/field/has_and_belongs_to_many.rb', line 27

def associated_records
  records = field.value(record)

  associated_repository.find_all(scope: records)
end

#associated_repositoryObject



33
34
35
# File 'app/components/uchi/field/has_and_belongs_to_many.rb', line 33

def associated_repository
  field.associated_repository(record: record)
end