Add note about dealing with `DISTINCT` and PostgreSQL `json` columns.

This commit is contained in:
Phil 2017-07-01 15:39:34 -07:00
parent 9c468a2694
commit d0a2bedbb6
1 changed files with 8 additions and 0 deletions

View File

@ -492,6 +492,14 @@ def index
end
```
#### `PG::UndefinedFunction: ERROR: could not identify an equality operator for type json`
If you get the above error while using `distinct: true` that means that
one of the columns that Ransack is selecting is a `json` column.
PostgreSQL does not provide comparison operators for the `json` type. While
it is possible to work around this, in practice it's much better to convert those
to `jsonb`, as [recommended by the PostgreSQL documentation](https://www.postgresql.org/docs/9.6/static/datatype-json.html)
### Authorization (whitelisting/blacklisting)
By default, searching and sorting are authorized on any column of your model