railsadminteam / rails_admin

RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data
MIT License
7.89k stars 2.26k forks source link

How use searchable with json field? #3545

Open alexander-storozhenko opened 2 years ago

alexander-storozhenko commented 2 years ago

I have some table:

...
 t.jsonb "connection_info", default: {}
...

I want to filter my records by json field "offline_time"

I have a code:

field :online_time do
   searchable [SomeModel => { connection_info:  "offline_time" }] # this not works(

   formatted_value do
   ...
grillermo commented 2 years ago

You have to figure out the PostgreSQL syntax to query json fields and then use it in a custom search https://github.com/railsadminteam/rails_admin/wiki/Custom-Search