class Current < ActiveSupport::CurrentAttributes
attribute :tenant, :request_id
def tenant=(tenant)
super
Rails.logger.tagged("tenant=#{tenant&.id}") if tenant
<div class="layout" data-controller="viewport">
<%= turbo_frame_tag "master", class: "master-pane" do %>
<h1>Products</h1>
<ul class="product-list">
<% @products.each do |product| %>
<li>
<%= turbo_frame_tag dom_id(flag) do %>
<tr class="flag-row">
<td class="flag-name"><%= flag.name %></td>
<td class="flag-env"><%= flag.environment %></td>
<td class="flag-state">
<span class="badge badge--<%= flag.enabled? ? 'on' : 'off' %>">
class ReportsController < ApplicationController
def create
@report = current_user.reports.create!(
title: report_params[:title],
status: :pending,
progress: 0
module DefensiveDeserialization
extend ActiveSupport::Concern
MissingRecord = Struct.new(:gid) do
def missing?
true
module Cacheable
extend ActiveSupport::Concern
def cache_query(prefix, scope, expires_in: 15.minutes)
key = [prefix, cache_version_token(scope)].join("/")
class CreateAuditLogs < ActiveRecord::Migration[7.1]
def change
create_table :audit_logs do |t|
t.references :auditable, polymorphic: true, null: false
t.references :user, null: true, foreign_key: true
t.string :action, null: false
class ApplicationController < ActionController::Base
before_action :authenticate_user!
rescue_from ActionController::InvalidAuthenticityToken do
handle_unauthenticated(reason: :csrf)
end
class SnipPolicyScope
def initialize(member, relation = Snip.all)
@member = member
@relation = relation
end
module Notifications
class RecipientSerializer < ActiveJob::Serializers::ObjectSerializer
def serialize?(argument)
argument.is_a?(Notifications::Recipient)
end
# Controller responding with Turbo Stream
class PostsController < ApplicationController
def create
@post = Post.new(post_params)
if @post.save
module BoundedFanOut
Result = Struct.new(:value, :error) do
def ok?
error.nil?
end
end