Last Updated: February 25, 2016
·
1.017K
· whatupdave

Get all Postgres array entries in Rails

For example, if you have articles with tags stored in a Postgres array, you can select the unique set of tags like so:

Article.pluck('distinct unnest(tags)')