Class: Uchi::HasMany::AssociatedRecordsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Uchi::HasMany::AssociatedRecordsController
- Defined in:
- app/controllers/uchi/has_many/associated_records_controller.rb
Overview
Companion controller for the Stimulus-based has_many_controller.
Provides backend support for fetching associated records for a has_many field via AJAX.
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
14 15 16 17 18 19 |
# File 'app/controllers/uchi/has_many/associated_records_controller.rb', line 14 def index @current_values = field.value(parent_record) || [] @field_name = params[:field] @records = field.collection_query.call(find_all_records_from_association) end |