Code Explainers
Code explainers tagged #concerns
ruby
class Current < ActiveSupport::CurrentAttributes attribute :user, :request_id, :user_agent, :ip_address resets { Time.zone = nil }
Per-request audit trails with Current in Rails
thread-local-state
auditing
concerns
Intermediate
8 steps
ruby
class ReportingQuery def initialize(scope = ApplicationRecord) @scope = scope end
Routing heavy reports to a read replica in Rails
read-replica
database-roles
query-object
Intermediate
6 steps
ruby
module Paginatable extend ActiveSupport::Concern private
A reusable pagination concern in Rails
pagination
concerns
http-headers
Intermediate
8 steps
ruby
module Authenticatable extend ActiveSupport::Concern included do
JWT authentication as a Rails concern
authentication
jwt
concerns
Intermediate
6 steps
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