import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["wrapper", "template", "anchor"]
add(event) {
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["input"]
static values = { wait: { type: Number, default: 300 }, url: String }
class AdminController < ApplicationController
before_action :authenticate_admin!
before_action :disable_turbo_cache, only: %i[dashboard moderation_queue]
helper_method :turbo_cache_control_tag
<!DOCTYPE html>
<html>
<head>
<title>Contacts</title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
class CommentsController < ApplicationController
before_action :set_post
def new
@comment = @post.comments.build
end
class Comment < ApplicationRecord
belongs_to :post
belongs_to :author, class_name: "User"
validates :body, presence: true
<%= turbo_frame_tag dom_id(contact) do %>
<tr class="contact-row">
<td><%= contact.name %></td>
<td><%= contact.email %></td>
<td><%= contact.role.titleize %></td>
<td class="actions">
class CommentsController < ApplicationController
before_action :set_post
def create
@comment = @post.comments.build(comment_params)
class ApplicationCommand
Result = Struct.new(:value, :errors) do
def success?
errors.nil? || errors.empty?
end
class ReindexCheckpoint < ApplicationRecord
enum status: { idle: 0, running: 1, done: 2, failed: 3 }
validates :index_name, presence: true, uniqueness: true
def self.for(index_name)
class Category < ApplicationRecord
has_many :products, dependent: :restrict_with_error
has_many :subcategories,
class_name: "Category",
foreign_key: :parent_id,
dependent: :restrict_with_error
class CreateEmailDeliveries < ActiveRecord::Migration[7.1]
def change
create_table :email_deliveries do |t|
t.string :dedupe_key, null: false
t.string :mailer, null: false
t.string :action, null: false