class DynamicFinder
def initialize(records)
@records = records
end
def method_missing(method_name, *args, &block)
class NotificationsChannel < ApplicationCable::Channel
def subscribed
stream_for current_user
end
def unsubscribed
class User < ApplicationRecord
has_secure_password
RESET_TOKEN_TTL = 30.minutes
def self.reset_verifier
<h1>Catalog</h1>
<%= turbo_frame_tag "products" do %>
<div class="product-grid" data-controller="frame">
<% @products.each do |product| %>
<%= render "products/card", product: product %>
<%= tag.div id: dom_id(comment), class: "comment", data: { controller: "comment" } do %>
<div class="comment__body">
<%= comment.body %>
</div>
<footer class="comment__meta">
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["sentinel"]
static values = {
url: String
class User < ApplicationRecord
has_many :posts, foreign_key: :author_id
validates :email, presence: true,
uniqueness: { case_sensitive: false },
format: { with: URI::MailTo::EMAIL_REGEXP }
cleanup_expired_sessions:
cron: '0 2 * * *' # Daily at 2 AM
class: CleanupExpiredSessionsWorker
queue: low
description: Remove expired sessions from Redis
class WizardsController < ApplicationController
STEPS = %w[account profile confirm].freeze
before_action :set_step
def show
module KeysetPaginatable
extend ActiveSupport::Concern
class_methods do
def keyset_page(cursor: nil, limit: 20, direction: :desc)
limit = limit.to_i.clamp(1, 100)
Rails.application.config.middleware.insert_before(
Rack::Runtime,
Rack::Timeout,
service_timeout: 15 # 15 seconds
)
class LeaderboardCache
TOP_KEY = "leaderboard:top".freeze
STATS_KEY = "leaderboard:stats".freeze
def top_players
Rails.cache.fetch(TOP_KEY, expires_in: 5.minutes, race_condition_ttl: 15.seconds) do