diff --git a/app/controllers/artists_controller.rb b/app/controllers/artists_controller.rb index a85c7d992..986250c29 100644 --- a/app/controllers/artists_controller.rb +++ b/app/controllers/artists_controller.rb @@ -3,13 +3,11 @@ class ArtistsController < ApplicationController def new @artist = authorize Artist.new_with_defaults(permitted_attributes(Artist)) - @artist.build_wiki_page if @artist.wiki_page.nil? respond_with(@artist) end def edit @artist = authorize Artist.find(params[:id]) - @artist.build_wiki_page if @artist.wiki_page.nil? respond_with(@artist) end diff --git a/app/models/artist.rb b/app/models/artist.rb index 8e8608d0d..06b0c1af1 100644 --- a/app/models/artist.rb +++ b/app/models/artist.rb @@ -19,8 +19,6 @@ class Artist < ApplicationRecord has_one :tag_alias, :foreign_key => "antecedent_name", :primary_key => "name" belongs_to :tag, foreign_key: "name", primary_key: "name", default: -> { Tag.new(name: name, category: Tag.categories.artist) } - accepts_nested_attributes_for :wiki_page, update_only: true, reject_if: :all_blank - scope :banned, -> { where(is_banned: true) } scope :unbanned, -> { where(is_banned: false) } diff --git a/app/policies/artist_policy.rb b/app/policies/artist_policy.rb index ded6d7a6c..1cd5dc2f6 100644 --- a/app/policies/artist_policy.rb +++ b/app/policies/artist_policy.rb @@ -12,7 +12,7 @@ class ArtistPolicy < ApplicationPolicy end def permitted_attributes - [:name, :other_names, :other_names_string, :group_name, :url_string, :is_deleted, { wiki_page_attributes: [:id, :body] }] + [:name, :other_names, :other_names_string, :group_name, :url_string, :is_deleted] end def permitted_attributes_for_new diff --git a/app/views/artists/_form.html.erb b/app/views/artists/_form.html.erb index cb4990b63..d4a200708 100644 --- a/app/views/artists/_form.html.erb +++ b/app/views/artists/_form.html.erb @@ -5,8 +5,14 @@ <%= f.input :group_name %> <%= f.input :url_string, :label => "URLs", :as => :text, :input_html => {:size => "50x15", :value => params.dig(:artist, :url_string) || @artist.urls.join("\n")}, :hint => "You can prefix a URL with - to mark it as dead." %> - <%= f.simple_fields_for :wiki_page do |fw| %> - <%= fw.input :body, label: "Wiki", input_html: { size: "50x15" } %> + <% if @artist.wiki_page.present? %> +