Refactor invitation and workshop sponsor handling#2483
Open
mroderick wants to merge 6 commits intocodebar:masterfrom
Open
Refactor invitation and workshop sponsor handling#2483mroderick wants to merge 6 commits intocodebar:masterfrom
mroderick wants to merge 6 commits intocodebar:masterfrom
Conversation
Replaces update_attribute usage with semantic methods that run validations. - accept!(rsvp_time:, automated_rsvp:) - confirms attendance with timestamp - decline! - cancels attendance Both methods use update! and raise RecordInvalid on validation failures. Includes unit tests.
Adds semantic methods for RSVP management with validation support. - accept! - confirms meeting attendance - decline! - cancels meeting attendance Includes unit tests.
Adds methods for event invitation management: - accept!(verified:) - confirms attendance with optional pre-verification - verify! - marks attendance as verified - decline! - cancels event attendance Includes unit tests.
Adds methods for managing sponsor host status: - set_as_host! - designates sponsor as workshop host - remove_as_host! - removes host designation Includes unit tests.
4a72e7d to
cc0c2fa
Compare
Replaces update_attribute calls in controllers and specs with new model methods: - InvitationsController: use accept!, verify!, decline! - InvitationControllerConcerns: use decline! with transaction wrapper - Admin::SponsorConcerns: use set_as_host!, remove_as_host!
cc0c2fa to
c4a4ae8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I started looking for outdated/deprecated Rails code in the repository.
update_attributewas at the top of that list according to the LLM I used ... though I do still see it in the API docs.In any case, I think the code reads a lot better this way.
Summary
Replaces all 22 occurrences of deprecated
update_attribute(removed in Rails 7.0+) with semantic model methods.Changes
New model methods:
WorkshopInvitation#accept!/decline!- Workshop RSVP managementMeetingInvitation#accept!/decline!- Meeting RSVP managementInvitation#accept!/decline!/verify!- Event invitation managementWorkshopSponsor#set_as_host!/remove_as_host!- Sponsor host managementSafety improvements:
ActiveRecord::RecordInvalidhandler in ApplicationControllerTechnical change: Uses
update!instead ofupdate_attribute- validations now run (behavioral improvement from silent failures to explicit errors)Context
Based on the deprecated Rails practices analysis in docs/deprecated-rails-practices-report.md, this addresses the highest-priority issue: the 23 occurrences of
update_attribute(22 in code, 1 in historical migration).Files Changed
Testing
All tests pass. Model methods include unit tests for validation behavior.