Skip to content
Snippets Groups Projects
Commit 159531fb authored by Marcela Ribeiro de Oliveira's avatar Marcela Ribeiro de Oliveira
Browse files

search_data verify if collection owner is nil

parent 5f9fe668
No related branches found
No related tags found
No related merge requests found
...@@ -74,11 +74,12 @@ class Collection < ApplicationRecord ...@@ -74,11 +74,12 @@ class Collection < ApplicationRecord
has_paper_trail has_paper_trail
def search_data def search_data
owner_name = (owner.nil? || owner.name.blank?) ? "" : owner.name
{ {
name: name, name: name,
description: description, description: description,
privacy: privacy, privacy: privacy,
owner: owner.name, owner: owner_name,
tags: tags.map(&:name), tags: tags.map(&:name),
subjects: subjects.pluck(:id), subjects: subjects.pluck(:id),
educational_stages: educational_stages.pluck(:id), educational_stages: educational_stages.pluck(:id),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment