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 50 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
Co-authored-by: Petrik de Heus <petrik@deheus.net>
Co-authored-by: Petrik de Heus <petrik@deheus.net>
Co-authored-by: Petrik de Heus <petrik@deheus.net>
Co-authored-by: Petrik de Heus <petrik@deheus.net>
Co-authored-by: Petrik de Heus <petrik@deheus.net>
Co-authored-by: Petrik de Heus <petrik@deheus.net>
Co-authored-by: Petrik de Heus <petrik@deheus.net>
Co-authored-by: Petrik de Heus <petrik@deheus.net>
Co-authored-by: Petrik de Heus <petrik@deheus.net>
Co-authored-by: Petrik de Heus <petrik@deheus.net>
end
```

```irb
irb> @baby = Baby.create
irb> baby = Baby.create
Copy link

Choose a reason for hiding this comment

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

this may be misunderstood, to test we need to interact with rails console instead irb.

Copy link
Contributor

Choose a reason for hiding this comment

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

I might be wrong, but didn't Rails update the irb prompt in newer versions? I'll double check.

@carlosantoniodasilva carlosantoniodasilva self-assigned this Apr 24, 2024
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
Copy link
Member

@carlosantoniodasilva carlosantoniodasilva left a comment

Choose a reason for hiding this comment

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

Very nice updates overall @Ridhwana , the guide flows much more naturally. I had a few bits of feedback/suggestions below.

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
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
guides/source/active_record_callbacks.md 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
guides/source/active_record_callbacks.md Outdated Show resolved Hide resolved
@zzak zzak changed the title [RF-DOCS] Active Record Callbacks [ci-skip] [RF-DOCS] Active Record Callbacks Apr 30, 2024
Ridhwana and others added 10 commits May 2, 2024 12:33
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: hatsu <hajiwata0308@gmail.com>
Co-authored-by: hatsu <hajiwata0308@gmail.com>
Co-authored-by: hatsu <hajiwata0308@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
@Ridhwana
Copy link
Contributor Author

Ridhwana commented May 2, 2024

Very nice updates overall @Ridhwana , the guide flows much more naturally. I had a few bits of feedback/suggestions below.

Thanks, @carlosantoniodasilva, your feedback has been great as usual! I've updated the guides based on your feedback, and would appreciate if you could double-check these:

Copy link
Contributor

@brunoprietog brunoprietog left a comment

Choose a reason for hiding this comment

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

Great update!

guides/source/active_record_callbacks.md Show resolved Hide resolved
guides/source/active_record_callbacks.md 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

9 participants