Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get all associated records in filters #3358

Open
fnicastri opened this issue May 24, 2021 · 0 comments
Open

Get all associated records in filters #3358

fnicastri opened this issue May 24, 2021 · 0 comments

Comments

@fnicastri
Copy link

fnicastri commented May 24, 2021

Hi,
I'm hitting a wall with the filters.

I have two models and the relative rails_admin conf:

class ImageBase < ApplicationRecord
  has_and_belongs_to_many :authors, optional: true
  [...]
end

class Author < ApplicationRecord
  has_and_belongs_to_many :image_bases, class_name: 'ImageBase'
  [...]
end

config.model 'ImageBase' do
    list do
      scopes [:published, :draft, nil]
      filters %i[collocazione authors]
      [...]
      field :authors do # (4)
        eager_load true
        queryable true
        visible true
        searchable %i[name surname]
      end
      search_by :search_image_base_admin
    end
end

My problem is that when I filter the ImageBase by Author in Rails_admin the results only show the matching Author and not all the authors related to the imagebase record.

I need this mainly to export the data after the filtering, it is not just an issue in the listing view (I can live with that)

Can't find a solution in the docs nor on the net,
any suggestion/solution? @sferik

Thanks
Francesco

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant