How do you deal with enums in this setup? Say I have an integer column and I use enums in it - 0 is "no" and 1 is "yes". How do you filter for the strings rather than the integers within the table?
Great question. It really depends on the complexity to which you've modified the datatables. If you are using server side data and a full text engine, then I would store the 'yes' and 'no' values as part of the indexed data.
If you're using Rails 5.1.x then you could also use a virtual attribute to search on instead of the integer column.
Thanks for the quick reply. I am indeed using Rails 5.1.x. Do you have an example in the context of your demo in how I could accomplish this with virtual attributes? Never heard of these and am reading about them now.
You can check out https://www.driftingruby.com/episodes/virtual-columns-in-mysql and https://www.driftingruby.com/episodes/virtual-columns-with-json-data-types on Virtual Columns.
Thanks! Very useful. I understand the concept, but I'm still not sure what the best approach would be to use virtual attributes against an integer column and somehow extract a string from that. Would I need to define a virtual attribute for each integer that I have mapped as an enum? In my case I have up to 10 enums in some columns.
Just a fyi - I ended up creating my own custom select boxes that handle filtering for my enum columns.