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 #rubydeveloper #rubyonrails #callbacks https://www.rubyonrails.ba/single/ruby-on-rails-callbacks-dry-out-your-models-using-concerns

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles