aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/welcome_controller.rb8
-rw-r--r--app/views/resources/_form.html.erb2
2 files changed, 5 insertions, 5 deletions
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
index ee73270..0c41e5a 100644
--- a/app/controllers/welcome_controller.rb
+++ b/app/controllers/welcome_controller.rb
@@ -62,10 +62,10 @@ class WelcomeController < ApplicationController
name: current_agent.name,
uuid: current_agent.uuid,
counts: {
- resources: current_agent.resources.count,
- taxonomies: current_agent.taxonomies.count,
- categories: current_agent.categories.count,
- sectiions: current_agent.sections.count
+ resources: current_agent.resources&.count,
+ taxonomies: current_agent.taxonomies&.count,
+ categories: current_agent.categories&.count,
+ sectiions: current_agent.sections&.count
}
},
my_agents: current_user.agents.map { |a| { uuid: a.uuid, name: a.name } }
diff --git a/app/views/resources/_form.html.erb b/app/views/resources/_form.html.erb
index fe5f532..89745bd 100644
--- a/app/views/resources/_form.html.erb
+++ b/app/views/resources/_form.html.erb
@@ -29,7 +29,7 @@ La description _peut_ comporter du [Markdown].
<fieldset>
<%= tag.legend "Classification" %>
<%# TODO Add a taxonomy selector %>
- <%= section_select(current_agent.taxonomies.first) %>
+ <%= section_select(current_agent.taxonomies&.first || Taxonomy.first) %>
</fieldset>
<fieldset>