Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Better error message when seeding fails due to missing reference

Christophe Bliard9a9f73ed9677
diff --git a/app/seeders/source/seed_data.rb b/app/seeders/source/seed_data.rb
index 13f9726bfe3..55d0e9829ae 100644
--- a/app/seeders/source/seed_data.rb
+++ b/app/seeders/source/seed_data.rb
@@ -60,10 +60,10 @@ class Source::SeedData
default
else
references = [reference, *fallbacks].map(&:inspect)
- message = <<~STRING
- Nothing registered with #{'reference'.pluralize(references.count)} #{references.to_sentence(locale: false)}
- Perhaps you forgot to add the `attribute_names_for_lookups` for your seeder?
- STRING
+ message = "Nothing registered with #{'reference'.pluralize(references.count)} #{references.to_sentence(locale: false)}"
+ if Rails.env.local?
+ message += "\nPerhaps you forgot to add the `attribute_names_for_lookups` for your seeder?"
+ end
raise ArgumentError, message
end
end