Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/mongoid-simple-tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ def all_tags(scope = {})
tags = self
tags = tags.where(scope) if scope.present?

results = tags.map_reduce(map, reduce).out(inline: true)
# @see - https://jira.mongodb.org/browse/MONGOID-4461
results = tags.map_reduce(map, reduce).out(inline: (Gem.loaded_specs['mongoid'].version.to_s >= '5.2' ? 1 : true))
results.to_a.map!{ |item| { :name => item['_id'], :count => item['value'].to_i } }
end

Expand All @@ -66,7 +67,7 @@ def tagged_with(tags)
tags = [tags] unless tags.is_a? Array
criteria.in(:tags => tags)
end

def tagged_without(tags)
tags = [tags] unless tags.is_a? Array
criteria.nin(:tags => tags)
Expand Down