diff --git a/app/models/account/seedeable.rb b/app/models/account/seedeable.rb index a4096c28e..3cceae251 100644 --- a/app/models/account/seedeable.rb +++ b/app/models/account/seedeable.rb @@ -3,8 +3,6 @@ module Account::Seedeable def setup_basic_template user = User.first - - Collection.create!(name: "Cards", creator: user, all_access: true) end def setup_customer_template diff --git a/app/models/collection.rb b/app/models/collection.rb index 504439e2e..7b756409d 100644 --- a/app/models/collection.rb +++ b/app/models/collection.rb @@ -12,13 +12,4 @@ class Collection < ApplicationRecord scope :alphabetically, -> { order("lower(name)") } scope :ordered_by_recently_accessed, -> { merge(Access.ordered_by_recently_accessed) } - - after_destroy_commit :ensure_default_collection - - private - def ensure_default_collection - if Collection.count.zero? - Collection.create!(name: "Cards") - end - end end diff --git a/app/views/collections/edit/_delete.html.erb b/app/views/collections/edit/_delete.html.erb index 7f13e84b1..627bfd1bd 100644 --- a/app/views/collections/edit/_delete.html.erb +++ b/app/views/collections/edit/_delete.html.erb @@ -1,8 +1,7 @@ -<% if Current.user.collections.many? %> - <%= form_with model: collection, class: "txt-align-center margin-block-start-auto", method: :delete do |form| %> - <%= form.button class: "btn txt-negative borderless txt-small", data: { turbo_confirm: "Are you sure you want to permanently delete this board?" } do %> - <%= icon_tag "trash" %> - Delete this board - <% end %> +<%= form_with model: collection, class: "txt-align-center margin-block-start-auto", method: :delete do |form| %> + <%= form.button class: "btn txt-negative borderless txt-small", data: { turbo_confirm: "Are you sure you want to permanently delete this board?" } do %> + <%= icon_tag "trash" %> + Delete this board <% end %> <% end %> + diff --git a/test/models/account/seedeable_test.rb b/test/models/account/seedeable_test.rb index 010df5661..aba88a2a5 100644 --- a/test/models/account/seedeable_test.rb +++ b/test/models/account/seedeable_test.rb @@ -5,18 +5,10 @@ class Account::SedeableTest < ActiveSupport::TestCase @account = Account.sole end - test "setup_basic_template adds collections" do - assert_changes -> { Collection.count } do - @account.setup_basic_template - end - end - test "setup_customer_template adds collections, cards, and comments" do assert_changes -> { Collection.count } do assert_changes -> { Card.count } do - assert_changes -> { Comment.count } do - @account.setup_customer_template - end + @account.setup_customer_template end end end