Class: Uchi::Field::BelongsTo::Show

Inherits:
Uchi::Field::Base::Show show all
Defined in:
app/components/uchi/field/belongs_to.rb

Instance Attribute Summary

Attributes inherited from Uchi::Field::Base::Show

#field, #record, #repository

Instance Method Summary collapse

Methods inherited from Uchi::Field::Base::Show

#initialize

Constructor Details

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

Instance Method Details

#associated_recordObject



60
61
62
# File 'app/components/uchi/field/belongs_to.rb', line 60

def associated_record
  field.value(record)
end

#associated_repositoryObject



64
65
66
67
68
69
# File 'app/components/uchi/field/belongs_to.rb', line 64

def associated_repository
  reflection = record.class.reflect_on_association(field.name)
  model = reflection.klass
  repository_class = Uchi::Repository.for_model(model)
  repository_class.new
end