mercredi 23 août 2017

ActiveAdmin Scope records by child association

I have a model called Request and it belongs_to polymophic relationship with various request types like Check, Cancellation...etc

I can do Request.first.request and I'll get the instantiated Check, or Cancellation record associated to it.

Within ActiveAdmin I have an index page that shows all the Request records.

I need to scope this index by records which are authenticated by the user.

That means that if a certain user can't manage requests for a Check, they shouldn't be able to see those requests in the request index at all.

I use the Pundit gem.

Aucun commentaire:

Enregistrer un commentaire