Created
May 7, 2018 20:02
-
-
Save flash-gordon/deef1d0153b2e6c45b0b021cfba2a4d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def search_tags(query, tags) | |
tag_queries = tags.map { |t| pattern(t) } | |
query.where { tag_queries.reduce(`false`) { |acc, q| acc | array_to_string(self.tags, ',').ilike(q) } } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment