json.array! @posts do |post|
json.cache! ['v1', post], expires_in: 1.hour do
json.id post.id
json.title post.title
json.excerpt post.excerpt
json.published_at post.published_at
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_member
def connect
self.current_member = env['warden']&.user || reject_unauthorized_connection
class AddSettingsToAccounts < ActiveRecord::Migration[7.1]
disable_ddl_transaction!
def change
add_column :accounts, :settings, :jsonb, null: false, default: {}
module EmailNormalization
extend ActiveSupport::Concern
included do
attr_accessor :soft_warnings
class Comment < ApplicationRecord
belongs_to :post, touch: true
belongs_to :author, class_name: "User"
validates :body, presence: true, length: { maximum: 10_000 }
import { Application } from "@hotwired/stimulus"
import FormSubmitController from "./controllers/form_submit_controller"
const application = Application.start()
application.debug = false
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static values = {
url: String,
delay: { type: Number, default: 800 },
class Comment < ApplicationRecord
belongs_to :article
belongs_to :author, class_name: "User"
validates :body, presence: true, length: { maximum: 2_000 }
# Installation
# rails active_storage:install
# rails db:migrate
# config/storage.yml
local:
<%# private stream: turbo signs the serialized record name %>
<%= turbo_stream_from current_user %>
<section class="notifications">
<h1>Notifications</h1>
<h1>Products</h1>
<%= form_with url: products_path, method: :get,
data: { turbo_frame: "products_list", turbo_action: "advance" } do |f| %>
<div class="filters">
<%= f.text_field :q, value: params[:q], placeholder: "Search products" %>
<div data-controller="disclosure">
<button type="button" data-action="disclosure#toggle" aria-expanded="false" class="font-medium">
Advanced
</button>
<div data-disclosure-target="panel" class="mt-2 hidden">
<%= render 'advanced_filters' %>