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)')
Written by Dave Newman
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Snappycode
Authors

whatupdave
3.501K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#