Expected behavior
Expect to be able to search and filter by JSONB columns
We use JSONB columns and keys within those columns for data storage. The actual JSONB columns do show in the ‘Details’ area but the keys within them do not and are not filterable.
We use the storext gem for our jsonb columns and they are set up within the models like so
store_attributes :options do
valid_account Boolean, default: true
last_error String, default: ''
url String, default: ''
end
Actual behavior
JSONB columns and the individual keys are not accessible or filterable
Context
Please provide any relevant information about your setup.
- Package Version: 7.3.0
- Database Dialect: postgresql
- Project Name: Ibex
Hey @ed.sparks, and welcome to our community 
I’m guessing these fields are shown as JSON (Using the JSON viewer widget) in your detail view?
That’s not something we support out of the box, so I’m pushing this as a feature request in our product board.
However, maybe having smart fields referencing these values may help in your case. Don’t hesitate to open a new thread if you give this a shot & new further help to implement those 
Hi @anon39848301 - thank you for getting back to me.
I have just created a smart field for this and thought it might be useful for anyone having a similar issue in the future to know that if you create a field of the same name as the key in the jsonb column. you don’t need to define the value inside.
Our field is ‘ce_new’ inside ‘options’ which is a jsonb column but our storext gem allows us to access this by calling
model_instance.ce_new
So our field in the collection can be written as
field :ce_new, type: 'Boolean'
without the block
You mean that this is working by simply adding the flatten field definition in your model?
If that’s the case, that’s great 
If everything is ok on your end, I’ll mark the thread as resolved 
This is actually inside the collection. we haven’t changed the model.
All working though
1 Like