diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-10-03 16:32:32 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-10-04 23:49:42 +0300 |
commit | 67815272dceb971c03bea3490ec26529b48a52b4 (patch) | |
tree | 455f30ba7fa73b94844e5ed36041d61c43f6e92b /app/models/concerns/group_descendant.rb | |
parent | 167fd71348d145c6fee953004bf77ceebf6efb1e (diff) |
Return an empty array when no matches are found
Diffstat (limited to 'app/models/concerns/group_descendant.rb')
-rw-r--r-- | app/models/concerns/group_descendant.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/concerns/group_descendant.rb b/app/models/concerns/group_descendant.rb index f37d23e615e..11f092db2ae 100644 --- a/app/models/concerns/group_descendant.rb +++ b/app/models/concerns/group_descendant.rb @@ -6,7 +6,7 @@ module GroupDescendant def self.build_hierarchy(descendants, hierarchy_top = nil) descendants = Array.wrap(descendants) - return if descendants.empty? + return [] if descendants.empty? unless descendants.all? { |hierarchy| hierarchy.is_a?(GroupDescendant) } raise ArgumentError.new('element is not a hierarchy') |