Open
Description
As a quick exercise, I have added the ability to search the array values with a regular expression.
The following scope was added to taggable.rb
scope :"with_#{tag_name}_like", ->(pattern) { subquery = unscoped.select("*, unnest(#{table_name}.#{tag_name}) AS subquery_tag"); select('*').from(subquery).where('subquery_tag ~* ?', pattern) }
This allows you to get tags as follows:
Object.with_tags_like('^Material')
Object.with_tags_like('^(Wood|Iron)')
Metadata
Metadata
Assignees
Labels
No labels