AuditLog.create!(
actor_id: current_user.id,
action: 'member.approve',
target_type: 'Member',
target_id: member.id,
ip_address: request.remote_ip,
Rails.application.routes.draw do
concern :tabs do
get :profile, on: :collection
get :billing, on: :collection
get :security, on: :collection
end
class Comment < ApplicationRecord
belongs_to :post
belongs_to :author, class_name: "User"
validates :body, presence: true, length: { maximum: 5_000 }
Rails.application.routes.draw do
namespace :api do
namespace :v1 do
resources :users, only: [:index, :show, :create, :update]
resources :posts do
resources :comments, only: [:index, :create]
class CreateAccountsAndLedger < ActiveRecord::Migration[7.1]
def change
create_table :accounts do |t|
t.string :name, null: false
t.string :currency, null: false, default: "USD"
t.bigint :balance_cents, null: false, default: 0
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["field"]
connect() {
class CommentsController < ApplicationController
before_action :set_post
def create
@comment = @post.comments.build(comment_params)
class WizardsController < ApplicationController
before_action :load_draft
def step_1
render_step(1)
end
class TypingPresence
EXPIRE_AFTER = 6 # seconds
def initialize(room, redis: Redis.current)
@room = room
@redis = redis
class CreateIdempotencyKeys < ActiveRecord::Migration[7.1]
def change
create_table :idempotency_keys do |t|
t.string :key, null: false
t.string :request_path, null: false
t.datetime :locked_at
module Middleware
class RequestTimer
def initialize(app)
@app = app
end
module ConnectionHealth
extend ActiveSupport::Concern
def with_fresh_connection
conn = ActiveRecord::Base.connection
conn.verify! # pings and reconnects if the socket is dead