diff options
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/6_0_release_notes.md | 46 | ||||
-rw-r--r-- | guides/source/active_record_callbacks.md | 27 | ||||
-rw-r--r-- | guides/source/layouts_and_rendering.md | 2 |
3 files changed, 72 insertions, 3 deletions
diff --git a/guides/source/6_0_release_notes.md b/guides/source/6_0_release_notes.md index 6c3091153f..a4edaa1180 100644 --- a/guides/source/6_0_release_notes.md +++ b/guides/source/6_0_release_notes.md @@ -267,10 +267,56 @@ Please refer to the [Changelog][active-job] for detailed changes. ### Removals +* Remove support for Qu gem. + ([Pull Request](https://github.com/rails/rails/pull/32300)) + ### Deprecations ### Notable changes +* Add support for custom serializers for Active Job arguments. + ([Pull Request](https://github.com/rails/rails/pull/30941)) + +* Add support for executing Active Jobs in the timezone in which + they were enqueued. + ([Pull Request](https://github.com/rails/rails/pull/32085)) + +* Allow passing multiple exceptions to `retry_on`/`discard_on`. + ([Commit](https://github.com/rails/rails/commit/3110caecbebdad7300daaf26bfdff39efda99e25)) + +* Allow calling `assert_enqueued_with` and `assert_enqueued_email_with` without a block. + ([Pull Request](https://github.com/rails/rails/pull/33258)) + +* Wrap the notifications for `enqueue` and `enqueue_at` in the `around_enqueue` + callback instead of `after_enqueue` callback. + ([Pull Request](https://github.com/rails/rails/pull/33171)) + +* Allow calling `perform_enqueued_jobs` without a block. + ([Pull Request](https://github.com/rails/rails/pull/33626)) + +* Allow calling `assert_performed_with` without a block. + ([Pull Request](https://github.com/rails/rails/pull/33635)) + +* Add `:queue` option to job assertions and helpers. + ([Pull Request](https://github.com/rails/rails/pull/33635)) + +* Add hooks to Active Job around retries and discards. + ([Pull Request](https://github.com/rails/rails/pull/33751)) + +* Add a way to test for subset of arguments when performing jobs. + ([Pull Request](https://github.com/rails/rails/pull/33995)) + +* Include deserialized arguments in jobs returned by Active Job + test helpers. + ([Pull Request](https://github.com/rails/rails/pull/34204)) + +* Allow Active Job assertion helpers to accept Proc for `only` + keyword. + ([Pull Request](https://github.com/rails/rails/pull/34339)) + +* Drop microseconds and nanoseconds from the job arguments in assertion helpers. + ([Pull Request](https://github.com/rails/rails/pull/35713)) + Ruby on Rails Guides -------------------- diff --git a/guides/source/active_record_callbacks.md b/guides/source/active_record_callbacks.md index 614737c342..8f54e78224 100644 --- a/guides/source/active_record_callbacks.md +++ b/guides/source/active_record_callbacks.md @@ -473,10 +473,33 @@ end => User was saved to database ``` -To register callbacks for both create and update actions, use `after_commit` instead. +There is also an alias for using the `after_commit` callback for both create and update together: + +* `after_save_commit` + +```ruby +class User < ApplicationRecord + after_save_commit :log_user_saved_to_db + + private + def log_user_saved_to_db + puts 'User was saved to database' + end +end + +# creating a User +>> @user = User.create +=> User was saved to database + +# updating @user +>> @user.save +=> User was saved to database +``` + +To register callbacks for both create and destroy actions, use `after_commit` instead. ```ruby class User < ApplicationRecord - after_commit :log_user_saved_to_db, on: [:create, :update] + after_commit :log_user_saved_to_db, on: [:create, :destroy] end ``` diff --git a/guides/source/layouts_and_rendering.md b/guides/source/layouts_and_rendering.md index 43cc958cb1..2808527141 100644 --- a/guides/source/layouts_and_rendering.md +++ b/guides/source/layouts_and_rendering.md @@ -420,7 +420,7 @@ If a template with the specified format does not exist an `ActionView::MissingTe ##### The `:variants` Option -This tells rails to look for template variations of the same format. +This tells Rails to look for template variations of the same format. You can specify a list of variants by passing the `:variants` option with a symbol or an array. An example of use would be this. |