Class: RuboCop::Cop::Captive::Rails::AfterCommitNotAllowed
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Captive::Rails::AfterCommitNotAllowed
- Defined in:
- lib/rubocop/cop/captive/rails/after_commit_not_allowed.rb
Overview
This cop checks for the use of after_commit in Rails models.
Using after_commit can lead to unexpected behaviors and is discouraged.
Instead, consider using a service object to handle the logic that would
otherwise be placed inside an after_commit callback.
For more information, see the documentation: https://captive.notion.site/Quota-expir-PDF-Monkey-25e707bff8eb8094ba48ecc564fe5bd7?source=copy_link
Constant Summary collapse
- MSG =
"Interdit l'utilisation de `after_commit` dans les modèles Rails. \ Utilisez un service plutôt."
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
45 46 47 |
# File 'lib/rubocop/cop/captive/rails/after_commit_not_allowed.rb', line 45 def on_send(node) add_offense(node, message: MSG) if after_commit?(node) end |