diff options
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/page.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/page.rb b/app/models/page.rb index cf003f74..a66527da 100644 --- a/app/models/page.rb +++ b/app/models/page.rb | |||
| @@ -61,7 +61,7 @@ class Page < ApplicationRecord | |||
| 61 | unless options[:tags].blank? | 61 | unless options[:tags].blank? |
| 62 | tag_names = options[:tags].gsub(/\s/, ",").split(",").map(&:strip).map(&:downcase).uniq.reject(&:blank?) | 62 | tag_names = options[:tags].gsub(/\s/, ",").split(",").map(&:strip).map(&:downcase).uniq.reject(&:blank?) |
| 63 | 63 | ||
| 64 | unless tag_names.empty? | 64 | unless tag_names.empty? |
| 65 | scope = scope | 65 | scope = scope |
| 66 | .joins("JOIN taggings ON taggings.taggable_id = pages.id | 66 | .joins("JOIN taggings ON taggings.taggable_id = pages.id |
| 67 | AND taggings.taggable_type = 'Page' | 67 | AND taggings.taggable_type = 'Page' |
| @@ -71,6 +71,11 @@ class Page < ApplicationRecord | |||
| 71 | .group("pages.id") | 71 | .group("pages.id") |
| 72 | .having("COUNT(DISTINCT tags.id) = ?", tag_names.length) | 72 | .having("COUNT(DISTINCT tags.id) = ?", tag_names.length) |
| 73 | end | 73 | end |
| 74 | |||
| 75 | CccConventions::TAG_SCOPES.values_at(*tag_names).compact.uniq.each do |root| | ||
| 76 | scope = scope.where("nodes.unique_name = ? OR nodes.unique_name LIKE ?", | ||
| 77 | root, "#{root}/%") | ||
| 78 | end | ||
| 74 | end | 79 | end |
| 75 | 80 | ||
| 76 | if options[:node] && options[:children] == "direct" | 81 | if options[:node] && options[:children] == "direct" |
