---
title: "Discussion on \"ActiveRecord anti-patterns which you should avoid: Part 2. Callbacks\" | Hashnode"
description: "Discussion on \"ActiveRecord anti-patterns which you should avoid: Part 2. Callbacks\". What are they?\nActiveRecord callback is a tricky Rails-way method to trigger some code in different phases of persisting model object.\nExample:\nclass Order < ApplicationRecord\n  before_save :set_total\n  after_commit :send_order_confirmation, on: :cre..."
url: "https://hashnode.com/posts/activerecord-anti-patterns-which-you-should-avoid-part-2-callbacks/5fc590450a072175ef2cfe01"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [ActiveRecord anti-patterns which you should avoid: Part 2. Callbacks](https://rubywizards.com/activerecord-anti-patterns-which-you-should-avoid-part-2-callbacks?utm_source=hashnode&utm_medium=feed)

What are they? ActiveRecord callback is a tricky Rails-way method to trigger some code in different phases of persisting model object. Example: class Order < ApplicationRecord before\_save :set\_total after\_commit :send\_order\_confirmation, on: :cre...

Dec 1, 2020 · 2 min read · rubywizards.com  
Read the article

-   [#ruby](https://hashnode.com/tag/ruby)
-   [#ruby-on-rails](https://hashnode.com/tag/ruby-on-rails)
-   [#rubyonrails](https://hashnode.com/tag/rubyonrails)

## Written by

[Piotr Jurewicz](https://hashnode.com/@pjurewicz)

@pjurewicz · Łódź, Poland

  
[View profile](https://hashnode.com/@pjurewicz)

ruby on rails developer

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
