diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb
index 02af1a511..3e21f9102 100644
--- a/app/controllers/categories_controller.rb
+++ b/app/controllers/categories_controller.rb
@@ -11,7 +11,7 @@ class CategoriesController < ApplicationController
end
def create
- @category = Category.new(category_params)
+ @category = Category.find_or_create_by(category_params)
@category.save
@category.splats << @splat
diff --git a/app/views/categories/new.html.erb b/app/views/categories/new.html.erb
index f0d75c82c..f9b057823 100644
--- a/app/views/categories/new.html.erb
+++ b/app/views/categories/new.html.erb
@@ -1,6 +1,12 @@
<%= form_with model: [@splat, @category], data: { turbo_frame: "_top" } do |form| %>
- <%= form.text_field :title, class: "input borderless", autofocus: "on" %>
+ <%= form.text_field :title, class: "input borderless", autofocus: "on", list: "categories-list" %>
<%= form.submit "Create Category", hidden: true %>
+
+
<% end %>
diff --git a/app/views/splats/index.html.erb b/app/views/splats/index.html.erb
index 6f60ef398..042e83b0e 100644
--- a/app/views/splats/index.html.erb
+++ b/app/views/splats/index.html.erb
@@ -75,7 +75,7 @@
<%= link_to splat, class: "splat__title-link flex align-center gap flex-item-grow" do %>
<%= splat.title %>
<% end %>
-
+
<% splat.categories.each do |category| %>
<%= link_to "# #{ category.title }", splats_path(category_id: category.id) %>
<% end %>