Skip to content

Commit

Permalink
quick fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Bob committed Sep 10, 2024
1 parent cb37696 commit b4dd715
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/avo/associations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def index
@parent_resource.hydrate(record: @parent_record)
association_name = BaseResource.valid_association_name(@parent_record, association_from_params)
@query = @related_authorization.apply_policy @parent_record.send(association_name)
@association_field = find_association_field(resource: @resource, association: params[:related_name])
@association_field = find_association_field(resource: @parent_resource, association: params[:related_name])

if @association_field.present? && @association_field.scope.present?
@query = Avo::ExecutionContext.new(target: @association_field.scope, query: @query, parent: @parent_record).handle
Expand Down
2 changes: 1 addition & 1 deletion lib/avo/concerns/find_association_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def find_association_field(resource:, association:)
type = params[:turbo_frame][/.*(?=_field)/]

resource.get_field_definitions.find do |field|
(field.id == association) && (field.type == type)
(field.id == association.to_sym) && (field.type == type)
end
else
resource.get_field association
Expand Down

0 comments on commit b4dd715

Please sign in to comment.