class AddLockVersionToPosts < ActiveRecord::Migration[6.1]
def change
add_column :posts, :lock_version, :integer, default: 0, null: false
end
end
<%# locals: item %>
<button
type="button"
class="toggle-btn"
data-controller="toggle"
data-action="click->toggle#toggle"
class PaymentService
def initialize
Stripe.api_key = Rails.application.credentials.stripe[:secret_key]
end
def create_payment_intent(amount:, currency: 'usd')
class AttachmentContentTypeValidator < ActiveModel::EachValidator
SIGNATURES = {
"image/png" => ["\x89PNG\r\n\x1a\n".b],
"image/jpeg" => ["\xFF\xD8\xFF".b],
"image/gif" => ["GIF87a".b, "GIF89a".b],
"application/pdf" => ["%PDF-".b]
class Task < ApplicationRecord
POSITION_GAP = 1024
belongs_to :board
scope :ordered, -> { order(:position) }
class SlidingWindowLimiter
Result = Struct.new(:allowed, :count, :limit, :window_ms, keyword_init: true)
SCRIPT = <<~LUA.freeze
local key = KEYS[1]
local now = tonumber(ARGV[1])
class Reminder < ApplicationRecord
belongs_to :user
validates :time_zone, inclusion: { in: ActiveSupport::TimeZone::MAPPING.values }
validates :local_time, presence: true
class DebouncedReindexJob
include Sidekiq::Job
sidekiq_options queue: :indexing, retry: 5
DEBOUNCE_DELAY = 5 # seconds
require 'sinatra/base'
require_relative 'cart'
require_relative 'cart_helpers'
class StoreApp < Sinatra::Base
enable :sessions
module FlashHelper
FLASH_CLASSES = {
"notice" => "flash--success",
"alert" => "flash--error",
"error" => "flash--error"
}.freeze
module Api
module V1
class PostsController < BaseController
before_action :authenticate_user!
def create
class ApplicationError < StandardError
attr_reader :context
class << self
def context_keys(*keys)
@context_keys = keys unless keys.empty?