Class: Uchi::HasMany::AssociatedRecordsController
- Inherits:
-
ApplicationController
- Object
- Controller
- 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
15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/uchi/has_many/associated_records_controller.rb', line 15 def index @current_values = field.value(parent_record) || [] @field_name = params[:field] @records = Uchi::CallWithFlexibleArguments .new(field.collection_query) .call( context: uchi_context, query: find_all_records_from_association ) end |