artists: don't return domains in /artists/{id}.xml.

Don't return the `domains` field in /artists/{id}.{json,xml}. Fixes a
failure in /artists/{id}.xml:

    https://danbooru.donmai.us/artists/156646.xml

    <result success="false">
        undefined method `domains' for #<ArtistUrl:0x00005566dd340af0> Did you mean? DomainName
    </result>

`to_xml` passes down the `methods` param to all nested models, which
doesn't work.
This commit is contained in:
evazion
2019-11-17 18:24:06 -06:00
parent 320ff01e07
commit 91d1817abf
2 changed files with 8 additions and 1 deletions

View File

@@ -46,7 +46,7 @@ class ArtistsController < ApplicationController
def show
@artist = Artist.find(params[:id])
@post_set = PostSets::Artist.new(@artist)
respond_with(@artist, methods: [:domains], include: [:urls])
respond_with(@artist)
end
def create

View File

@@ -38,6 +38,13 @@ class ArtistsControllerTest < ActionDispatch::IntegrationTest
end
end
context "show action" do
should "work for xml responses" do
get artist_path(@masao.id), as: :xml
assert_response :success
end
end
should "get the new page" do
get_auth new_artist_path, @user
assert_response :success