class ApplicationController < ActionController::Base
helper_method :turbo_native_app?
private
def turbo_native_app?
module Paginatable
extend ActiveSupport::Concern
Page = Struct.new(:records, :next_cursor, keyword_init: true)
DEFAULT_LIMIT = 25
class ApplicationController < ActionController::Base
before_action :set_turbo_cache_control
class_attribute :turbo_no_cache, default: false
def self.no_turbo_cache
<div class="settings-layout">
<nav class="settings-sidebar">
<h2>Settings</h2>
<ul>
<% settings_sections.each do |section| %>
<li class="<%= "active" if current_page?(section.path) %>">
class Product < ApplicationRecord
scope :by_status, ->(status) {
status.present? ? where(status: status) : all
}
scope :in_category, ->(category_id) {
class ImportResult
RowError = Struct.new(:line, :messages)
attr_reader :imported, :row_errors
def initialize
class DeliveryObserver
def self.delivered_email(message)
new(message).record
end
def initialize(message)
class PriceBreakdown < Struct.new(:subtotal_cents, :discount_cents, :tax_cents, keyword_init: true)
def initialize(*)
super
freeze
end
class LastSeenTracker
THROTTLE = 5.minutes
PENDING_KEY = "pending:last_seen".freeze
class << self
def touch(user_id, at: Time.current)
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static values = { keymap: Object }
connect() {
export type PostId = string & { readonly brand: unique symbol }
export type UserId = string & { readonly brand: unique symbol }
export interface User {
id: UserId
name: string
class CreateReservations < ActiveRecord::Migration[7.1]
def up
enable_extension "btree_gist" unless extension_enabled?("btree_gist")
create_table :reservations do |t|
t.references :room, null: false, foreign_key: true