Rails ActiveAdmin Change Collection By Param

I’m working on a project that has ‘users’ and ‘reviews’ activeadmin resources: In the ‘users’ tab when you show a user I need to have a link to the specific user’s reviews .
Currently there’s a sidebar that links to the reviews

div do
  link_to "Reviews - #{user.reviews.count}", admin_reviews_path(q: {user_id_eq: user.id})

But this just leads to the reviews tab and doesn’t show the specific user’s reviews (the param seems to be meaningless).
Any advice on how I can change the index method in reviews tab to render a different collection by the param?

 #somehow make this action return all reviews that belong to a user if the param is there

  index do
  column :reviewer
  column :product

Source: ruby

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.