Ruby on Rails Callbacks - DRY out your models using Concerns
03-Nov-2018 2377
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 #Rails #Callbacks #models #using #Concerns #callbacks https://www.rubyonrails.ba/link/ruby-on-rails-callbacks-dry-out-your-models-using-concerns