Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RF-DOCS] Active Record Callbacks #51654

Open
wants to merge 91 commits into
base: main
Choose a base branch
from

Conversation

Ridhwana
Copy link
Contributor

Motivation / Background

This Pull Request has been created to provide more clarity and update the Active Record Callbacks documentation.

Detail

This guide has probably been reviewed multiple times over time, so we can do a quick pass to see where we can make things clearer, simpler, and/or more concise.

Some initial thoughts to get started:

  • Samples that use Proc.new {} can likely be simplified to just use proc {}
  • Link to the validations guide where we mention it under conditional callbacks
  • after_find callbacks are also triggered by a few other methods: take, sole, find_by!
  • We could potentially add some more examples on different types of callbacks that aren't there.
  • Updated some sections for clarity

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Unrelated changes should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

Ridhwana and others added 30 commits March 28, 2024 13:16
@Ridhwana Ridhwana requested a review from p8 June 7, 2024 05:23
guides/source/active_record_callbacks.md Outdated Show resolved Hide resolved
NOTE: If an `ActiveRecord::RecordNotDestroyed` is raised within `after_destroy`, `before_destroy` or `around_destroy` callback, it will not be re-raised and the `destroy` method will return `false`.
NOTE: If an `ActiveRecord::RecordNotDestroyed` is raised within `after_destroy`,
`before_destroy` or `around_destroy` callback, it will not be re-raised and the
`destroy` method will return `false`.

Relational Callbacks
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "Cascading Association Callbacks" is a great title.
These changes are really nice.

guides/source/active_record_callbacks.md Outdated Show resolved Hide resolved
guides/source/active_record_callbacks.md Outdated Show resolved Hide resolved
guides/source/active_record_callbacks.md Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs rails foundation Rails Foundation PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants