Skip to content

Commit

Permalink
Make Tag.controlled_by_mapping scope join-friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
cben committed Jan 3, 2018
1 parent 8ec14c8 commit 5353916
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def categorization
# @return [ActiveRecord::Relation] Scope for tags controlled by ContainerLabelTagMapping.
def self.controlled_by_mapping
queries = ContainerLabelTagMapping::TAG_PREFIXES.collect do |prefix|
where("name LIKE ?", "#{sanitize_sql_like(prefix)}%")
where(arel_table[:name].matches("#{sanitize_sql_like(prefix)}%", nil, true)) # case sensitive LIKE
end
queries.inject(:or).read_only.is_entry
end
Expand Down

0 comments on commit 5353916

Please sign in to comment.