Skip to content

fix to_xml for unprocessable_entity responses#250

Open
kzink wants to merge 1 commit intoheartcombo:mainfrom
kzink:main
Open

fix to_xml for unprocessable_entity responses#250
kzink wants to merge 1 commit intoheartcombo:mainfrom
kzink:main

Conversation

@kzink
Copy link
Copy Markdown

@kzink kzink commented Sep 24, 2024

Rails 7+ has removed ActiveModel::Errors#to_xml which responders was relying on to emit :unprocessable_entity errors in xml format. You'll see something like this if it tries to render the error collection into a response:

undefined method `bytesize' for #<ActiveModel::Error attribute=name, type=blank, options={}>

I cobbled together a fix for this by pulling out the formatting method used in Rails 6 to restore the functionality. Unsure if this works in Rails <6 so it might be worth gating with a conditional.

@carlosantoniodasilva
Copy link
Copy Markdown
Member

@kzink apologies for the gap here... are you still running into issues with to_xml that might need responders fixing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants