Skip to content

Answer address requests for a person without one with a 404 - #216

Open
edubraqd wants to merge 1 commit into
rubyforgood:ruby-for-good-2026from
edubraqd:fix/address-missing-record
Open

edubraqd wants to merge 1 commit into
rubyforgood:ruby-for-good-2026from
edubraqd:fix/address-missing-record

Conversation

@edubraqd

Copy link
Copy Markdown

What this does

AddressesController#set_address handed nil to show, update and destroy when the person had no address yet, so each of them raised (nil partial, nil.update, nil.destroy!) and answered 500. Raising ActiveRecord::RecordNotFound there turns all three into the 404 they should be.

Issue

No open issue; found while poking at the person pages. Happy to open one if you prefer tracking it that way.

Testing

  • Covered by tests

Controller tests for show, update and destroy on a person without an address, asserting 404. All three fail with a 500 without the change.

Ran bin/rails test (132 runs, 0 failures) and bin/rubocop clean.

Written with help from Claude Code; I reviewed and ran everything myself.

🤖 Generated with Claude Code

set_address handed nil to show, update and destroy when the person had
no address yet, so each of them raised (nil partial, nil.update,
nil.destroy!) and answered 500. Raising RecordNotFound there turns all
three into the 404 they should be.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant