From bcaefa0a7ecd5bc865120bd6b934aceca67f6936 Mon Sep 17 00:00:00 2001 From: evazion Date: Thu, 1 Aug 2019 19:34:21 -0500 Subject: [PATCH] Fix #4107: Can't create artist entry if tag already has a wiki #4107 --- app/models/artist.rb | 8 -------- test/unit/artist_test.rb | 12 ------------ 2 files changed, 20 deletions(-) diff --git a/app/models/artist.rb b/app/models/artist.rb index 947d91a9f..94f3666ec 100644 --- a/app/models/artist.rb +++ b/app/models/artist.rb @@ -12,7 +12,6 @@ class Artist < ApplicationRecord after_save :update_wiki after_save :clear_url_string_changed validates :name, tag_name: true, uniqueness: true - validate :validate_wiki, :on => :create belongs_to_creator has_many :members, :class_name => "Artist", :foreign_key => "group_name", :primary_key => "name" has_many :urls, :dependent => :destroy, :class_name => "ArtistUrl", :autosave => true @@ -391,13 +390,6 @@ class Artist < ApplicationRecord wiki_page.save end end - - def validate_wiki - if WikiPage.titled(name).exists? - errors.add(:name, "conflicts with a wiki page") - return false - end - end end module TagMethods diff --git a/test/unit/artist_test.rb b/test/unit/artist_test.rb index e84c4b370..9eea19b53 100644 --- a/test/unit/artist_test.rb +++ b/test/unit/artist_test.rb @@ -128,18 +128,6 @@ class ArtistTest < ActiveSupport::TestCase assert_equal(artist.name, artist.wiki_page.title) end - context "when a wiki page with the same name already exists" do - setup do - @wiki_page = FactoryBot.create(:wiki_page, :title => "aaa") - @artist = FactoryBot.build(:artist, :name => "aaa") - end - - should "not validate" do - @artist.save - assert_equal(["Name conflicts with a wiki page"], @artist.errors.full_messages) - end - end - should "update the wiki page when notes are assigned" do artist = FactoryBot.create(:artist, :name => "aaa", :notes => "testing") artist.update_attribute(:notes, "kokoko")