class UserSearchQuery
def initialize(relation = User.all)
@relation = relation
end
def call(params)
class Post < ApplicationRecord
has_many :comments, dependent: :destroy
# comments_count is maintained by counter_cache on Comment#belongs_to
scope :stale_comment_counts, lambda {
class CommentsController < ApplicationController
def create
@post = Post.find(params[:post_id])
@comment = @post.comments.build(comment_params)
@comment.author = current_user
class TransferFundsService
def initialize(from_account:, to_account:, amount:)
@from_account = from_account
@to_account = to_account
@amount = amount
end
<div class="layout" data-controller="sidebar">
<aside class="sidebar">
<%= render "shared/sidebar", active: params[:controller] %>
</aside>
<main class="content-area">
<div class="orders-layout" data-controller="drawer">
<table class="orders">
<tbody>
<% @orders.each do |order| %>
<tr>
<td><%= order.reference %></td>
class CommentsChannel < ApplicationCable::Channel
def subscribed
post = find_post
if post
stream_for post
else
# Gemfile
gem 'draper'
# app/decorators/user_decorator.rb
class UserDecorator < Draper::Decorator
delegate_all
require 'sinatra/base'
require 'json'
require_relative 'signature_verifier'
class WebhookApp < Sinatra::Base
configure do
class CacheNamespace
attr_reader :name
def initialize(name, store: Rails.cache)
@name = name.to_s
@store = store
class CreateStripeEvents < ActiveRecord::Migration[7.1]
def change
create_table :stripe_events do |t|
t.string :stripe_event_id, null: false
t.string :event_type, null: false
t.string :status, null: false, default: "received"
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["checkbox", "selectAll", "count", "submit"]
static values = { selectedIds: Array }