inherited_resources icon indicating copy to clipboard operation
inherited_resources copied to clipboard

`param` is not working with `belongs_to`

Open samstickland opened this issue 4 years ago • 0 comments

I have this configuration in my activeadmin file:

  ActiveAdmin.register Assignments::Model::Rate, as: 'Rate' do
    belongs_to :assignment, param: :reference_number, parent_class: Assignments::Model::Assignment

But I'm not seeing the route get generated with the right param name:

be rails routes | grep edit_admin_assignment_rate

edit_admin_assignment_rate GET      /admin/assignments/:assignment_id/rates/:id/edit(.:format)                                        admin/rates#edit

I'm expecting assignment_id to be reference_number

I've dug into the source code a bit and I can't see how the param config is supposed to be used:

It looks to like that config is only ever retrieved here, and only used inside of this block, where param isn't accessed: https://github.com/activeadmin/inherited_resources/blob/219d08837ffb7edeb49a213d91e094fc85e3d7ff/lib/inherited_resources/url_helpers.rb#L71

ActiveAdmin: 2.9.0 InheritedResources: 1.13.0 Ruby: 3.0.2

samstickland avatar Nov 16 '21 15:11 samstickland