Code Explainers

Code explainers tagged #concerns

ruby
class Comment < ApplicationRecord
  belongs_to :commentable, polymorphic: true, counter_cache: true
  belongs_to :author, class_name: "User"
 

How polymorphic comments work in Rails

polymorphic-association concerns counter-cache
Intermediate 8 steps
ruby
module SoftDeletable
  extend ActiveSupport::Concern
 
  included do

How a soft-delete concern works in Rails

concerns soft-delete scopes
Intermediate 8 steps