newsletter Stay up - to date with the latest news, Sign Up today!

Ruby on Rails Callbacks - DRY out your models using Concerns

When writing an extension for a Ruby on Rails model, an ActiveSupport Concern could be a good choice. They work like mixin modules that can be included in a class, but have some extra benefits for Rails models, such as the ability to add Callbacks.This post will show you how to DRY out your code so that your Concern not only adds custom methods to records, but also add Callbacks to trigger on create, update, and delete. It will also cover how to run your tests in a way that manages these Callbacks. Ruby on Rails Callbacks - DRY out your models using Concerns #ruby #rails #rubyonrails #bosnia #programming #tutorials #rubydeveloper #railsdeveloper