Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4616

Is There A Way To Iterate Datagrid Filter Rails?

$
0
0

I've been learning to implement a small ROR system, and using a powerful Datagrid gem for filtering, sorting, exporting data, etc.

Today, I've been trying to iterate the filters based on children object.Let say:- I have a main Client object which I do the filtering- Client has and belongs to many Products- Product has and belongs to many Clients- Product belongs to Category

In my case:- Category A has 3 products P1, P2, P3- Category B has 2 products P4, P5- Client has 5 products P1, P2, P3, P4 & P5

Currently, I can implement only one Product filter which I retrieve all the products used by the Client.

Buy what I want is to split the products by their Category. So, it should have two Category filters. The problem is that iteration cannot be used in Datagrid class.

I wonder if there is a way like:

Category.all.each do |category|    filter(:category_name, :enum, ...) do |scope|        ...    endend

Viewing all articles
Browse latest Browse all 4616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>